<?php
namespace app\admin\controller;

use think\Controller;

class Home extends controller
{
      //详细设定
    public function detailed($id){
            $announce = model('announce')->findstatus(2);
            $res = model('returnwater')->finduid($id);
            $un = model('user')->where('id',$id)->find();
            $this->assign('res',$res);
            $this->assign('name',$un['name']);
            $this->assign('announce',$announce);
            // mp($resultB);
            return $this->fetch(); 
    }
    
    //判断并提取符合条件的时间戳bobo
    public function timeinterval(){
        $stime = time();
        // $stime = 1522339200;
        $res=model('openplate')->findtime1();
        // mp($res);
        foreach($res as $key => $item){
            if($stime>=$item['opentime'] && $stime<=$item['tclosetime']){
                $result = 1;//在开盘中
                return $result;
                exit();
            }
            $opentime[$item['datetime']] = $item['opentime'];
            $tclosetime[$item['datetime']] = $item['tclosetime'];
            $zclosetime[$item['datetime']] = $item['zclosetime'];
        }

        foreach($opentime as $key1 => $item1){
            if($stime < $item1){
                $opentime2[] = $item1;
                $a = array_search(min($opentime2), $opentime2);
                $result['opentime'] = $opentime2[$a]; 
            }
        }

        foreach($tclosetime as $key2 => $item2){
            if($stime < $item2){
                $tclosetime2[] = $item2;
                $a = array_search(min($tclosetime2), $tclosetime2);
                $result['tclosetime'] = $tclosetime2[$a]; 
            }
        }

        foreach($zclosetime as $key2 => $item2){
            if($stime < $item2){
                $zclosetime2[] = $item2;
                $a = array_search(min($zclosetime2), $zclosetime2);
                $result['zclosetime'] = $tclosetime2[$a]; 
            }
        }
                        
        return $result;
    }

    public function index()
    {
        return $this->fetch();
    }
    //id链 
    // 需要判断登陆后的usertype值3-7
    // 对应起来返回一个数组id3大股东到id7会员 如果是总监的话 加上本身userid
    public function id(){
        switch (session('usertype')) {
            case 1:
            $u1 = session('adminid');
            $u2 = model('user')->findtopuser1(session('adminid'));
            foreach($u2 as $k1 => $res2k){
                $u3 = model('user')->findtopuser1($res2k);
            }
            foreach($u3 as $k2 => $res3k){
                $u4 = model('user')->findtopuser1($res3k);
            }
            foreach($u4 as $k3 => $res4k){
                $u5 = model('user')->findtopuser1($res4k);
            }
            foreach($u5 as $k4 => $res5k){
                $u6 = model('user')->findtopuser1($res5k);
            }
            foreach($u6 as $k5 => $res6k){
                $u7 = model('user')->findtopuser1($res6k);
            }
            $result["u1"]=$u1;
            $result["u2"]=$u2;
            $result["u3"]=$u3;
            $result["u4"]=$u4;
            $result["u5"]=$u5;
            $result["u6"]=$u6;
            $result["u7"]=$u7;
            return $result;
            break;
            
            case 2:
            $u2 = session('adminid');
            // $u2 = model('user')->findtopuser1(session('adminid'));
            $u3 = model('user')->findtopuser1(session('adminid'));
            foreach($u3 as $k2 => $res3k){
                $u4 = model('user')->findtopuser1($res3k);
            }
            foreach($u4 as $k3 => $res4k){
                $u5 = model('user')->findtopuser1($res4k);
            }
            foreach($u5 as $k4 => $res5k){
                $u6 = model('user')->findtopuser1($res5k);
            }
            foreach($u6 as $k5 => $res6k){
                $u7 = model('user')->findtopuser1($res6k);
            }     
            $result["u2"]=$u2;
            $result["u3"]=$u3;
            $result["u4"]=$u4;
            $result["u5"]=$u5;
            $result["u6"]=$u6;
            $result["u7"]=$u7;
            return $result;
            break;

            case 3:
            $u3 = session('adminid');
            $u4 = model('user')->findtopuser1(session('adminid'));
            foreach($u4 as $k3 => $res4k){
                $u5 = model('user')->findtopuser1($res4k);
            }
            foreach($u5 as $k4 => $res5k){
                $u6 = model('user')->findtopuser1($res5k);
            }
            foreach($u6 as $k5 => $res6k){
                $u7 = model('user')->findtopuser1($res6k);
            }
            $result["u3"]=$u3;
            $result["u4"]=$u4;
            $result["u5"]=$u5;
            $result["u6"]=$u6;
            $result["u7"]=$u7;     
            // mp($result);
            return $result;
            break;

            case 4:
            $u4 = session('adminid');
            $u5 = model('user')->findtopuser1(session('adminid'));
            foreach($u5 as $k4 => $res5k){
                $u6 = model('user')->findtopuser1($res5k);
            }
            foreach($u6 as $k5 => $res6k){
                $u7 = model('user')->findtopuser1($res6k);
            }     
            $result["u4"]=$u4;
            $result["u5"]=$u5;
            $result["u6"]=$u6;
            $result["u7"]=$u7;
            return $result;
            break;

            case 5:
            $u5 = session('adminid');
                $u6 = model('user')->findtopuser1(session('adminid'));
            foreach($u6 as $k5 => $res6k){
                $u7 = model('user')->findtopuser($res6k);
            }     
            $result["u5"]=$u5;
            $result["u6"]=$u6;
            $result["u7"]=$u7;
            return $result;
            break;

            case 6:
                $u6= session('adminid');
                $u7 = model('user')->findtopuser1(session('adminid'));
                $result["u6"]=$u6;
                $result["u7"]=$u7;
                return $result;
                break;

            default:
            $u7 = session('adminid');     
            $result["u7"]= $u7;
            return $result;
            break;
        }
    }
    public function id2(){
        switch (session('usertype')) {
           case 1:
            $res2 = model('user')->findtopuser1(session('adminid'));
            if(!isset($res2)){
                return 0;
            }
            foreach($res2 as $k1 => $res2k){
                $res3 = model('user')->findtopuser1($res2k);
            }
            foreach($res3 as $k2 => $res3k){
                $res4 = model('user')->findtopuser1($res3k);
            }
            foreach($res4 as $k3 => $res4k){
                $res5 = model('user')->findtopuser1($res4k);
            }
            foreach($res5 as $k4 => $res5k){
                $res6 = model('user')->findtopuser1($res5k);
            }
            foreach($res6 as $k5 => $res6k){
                $res7 = model('user')->findtopuser1($res6k);
            }     
            $res = array_merge($res2,$res3,$res4,$res5,$res6,$res7);
            return $res;
            break;
            
            case 2:
            $res2[] = session('adminid');
            foreach($res2 as $k1 => $res2k){
                $res3 = model('user')->findtopuser1($res2k);
            }
            foreach($res3 as $k2 => $res3k){
                $res4 = model('user')->findtopuser1($res3k);
            }
            foreach($res4 as $k3 => $res4k){
                $res5 = model('user')->findtopuser1($res4k);
            }
            foreach($res5 as $k4 => $res5k){
                $res6 = model('user')->findtopuser1($res5k);
            }
            foreach($res6 as $k5 => $res6k){
                $res7 = model('user')->findtopuser1($res6k);
            }     
            $res = array_merge($res2,$res3,$res4,$res5,$res6,$res7);
            // mp($res);
            return $res;

                break;
            case 3:
            $res3[] = session('adminid');
            foreach($res3 as $k2 => $res3k){
                $res4 = model('user')->findtopuser1($res3k);
            }
            foreach($res4 as $k3 => $res4k){
                $res5 = model('user')->findtopuser1($res4k);
            }
            foreach($res5 as $k4 => $res5k){
                $res6 = model('user')->findtopuser1($res5k);
            }
            foreach($res6 as $k5 => $res6k){
                $res7 = model('user')->findtopuser1($res6k);
            }     
            $res = array_merge($res3,$res4,$res5,$res6,$res7);
            // mp($res);
            return $res;

                break;
                case 4:
                $res4[] = session('adminid');
                foreach($res4 as $k3 => $res4k){
                    $res5 = model('user')->findtopuser1($res4k);
                }
                foreach($res5 as $k4 => $res5k){
                    $res6 = model('user')->findtopuser1($res5k);
                }
                foreach($res6 as $k5 => $res6k){
                    $res7 = model('user')->findtopuser1($res6k);
                }     
                $res = array_merge($res4,$res5,$res6,$res7);
                // mp($res);
                return $res;

                    break;
                    case 5:
                    $res5[] = session('adminid');
                    foreach($res5 as $k4 => $res5k){
                        $res6 = model('user')->findtopuser1($res5k);
                    }
                    foreach($res6 as $k5 => $res6k){
                        $res7 = model('user')->findtopuser1($res6k);
                    }     
                    $res = array_merge($res5,$res6,$res7);
                    // mp($res);
                    return $res;

                        break;
                        case 6:
                        $res6[] = session('adminid');
                        foreach($res6 as $k5 => $res6k){
                            $res7 = model('user')->findtopuser1($res6k);
                        }     
                        $res = array_merge($res6,$res7);
                        // mp($res);
                        return $res;

                            break;
            default:
            $res7[] = session('adminid');     
            $res = array_merge($res7);
            // mp($res);
            return $res;

                break;
        }
        
    }
    // 报表管理
    public function red(){
        //查找期数区间
        $max = db("result")->max("datatime");
        $min = db("result")->min("datatime");
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);

        $this->assign("max",$max);
        $this->assign("min",$min);
        return $this->fetch();
    }

    // 报表查询
    public function redchcek() {
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        return $this->fetch();
        if (request()->isPost()) {
            exit();
            $redtype;
            $redtimes;
            $redmold;
            $stime;
            $etime;
            $stime = strtotime($stime);
            $etime = strtotime($etime);
            $this->assign('result', $result);
            return $this->fetch();
        }
    }

    public function redckout($type){
        return redckout($type);
    }
    // 注单
    public function notecheck()
    {
        $result = model("ordered")->findall();
        $resultqishu = model("ordered")->findallqishu();
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('result', $result);
        $this->assign('resultqishu', $resultqishu);
        return $this->fetch();
    }

    //注单查询
    public function note($type=0,$zhanghao,$stime=0,$etime=0,$qishu,$ss=0,$sf=0,$es=0,$ef=0,$fangshi,$zhonglei=0){
        // type 查询会员账号1 下注单号2 下注盘号3 $zhaohao
        // mp($res);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        if(empty($stime)){$stime= 0;}
        if(empty($etime)){$etime= 0;}
        if(empty($ss)){$ss = 0;}
        if(empty($sf)){$sf = 0;}
        if(empty($es)){$es = 0;}
        if(empty($ef)){$ef = 0;}
        if($type==0){$type = 3;$zhanghao = "a";}     
        $stime1 = strtotime($stime); 
        $ss1 = strtotime($ss);
        $sf1 = strtotime($sf);
        $stime2 = $stime1+$ss1+$sf1;   
        $etime1 = strtotime($etime); 
        $es1 = strtotime($es);
        $ef1 = strtotime($ef);
        $etime2 = $etime1+$es1+$ef1;
        if($type==3){
            if(empty($zhanghao)){$this->error("不能为空");}
            if ($zhanghao == 'a' || $zhanghao == 'A') {
                $zhanghao = 1;
            }
            if ($zhanghao == 'b' || $zhanghao == 'B') {
                $zhanghao = 2;
            }
            if ($zhanghao == 'c' || $zhanghao == 'C') {
                $zhanghao = 3;
            }
            if ($zhanghao == 'd' || $zhanghao == 'D') {
                $zhanghao = 4;
            }
            // mp($zhanghao);
            if($zhonglei==0){
                if($qishu==0){
                    $uid=$this->id2();
                    for($i=0;$i<sizeof($uid);$i++){
                    $zongbiao = model("ordered")->findandicap($zhanghao,$stime2,$etime2,$uid[$i]);
                    }
                    // mp($zongbiao);
                    $this->assign('zongbiao',$zongbiao);
                }else{
                    $uid=$this->id2();
                    for($i=0;$i<sizeof($uid);$i++){
                    $zongbiao = model("ordered")->findandicapqishu($zhanghao,$stime2,$etime2,$qishu,$uid[$i]);}
                    // mp($zongbiao);
                }
            }else{
                if($qishu==0){
                    $res = $this->redckout($zhonglei);
                    if(!empty($res['bets'])){
                        $uid=$this->id2();
                        for($i=0;$i<sizeof($res['bets']);$i++){
                            for($i=0;$i<sizeof($uid);$i++){
                            $zongbiao = model("ordered")->findandicapzhongleibets($item,$stime2,$etime2,$res['bet'],$res['colums'],$res['bets'][$i],$uid[$i]);}
                        }
                    }else{
                        $uid=$this->id2();
                        for($i=0;$i<sizeof($uid);$i++){
                        $zongbiao = model("ordered")->findandicapzhonglei($zhanghao,$stime2,$etime2,$res['bet'],$res['colums'],$uid[$i]);}
                        // mp($zongbiao);
                    }
                }else{                
                    $res = $this->redckout($zhonglei);
                    if(!empty($res['bets'])){
                        for($i=0;$i<sizeof($res['bets']);$i++){
                            $uid=$this->id2();
                            for($i=0;$i<sizeof($uid);$i++){
                            $zongbiao = model("ordered")->findandicapqishuzhongleibets($item,$stime2,$etime2,$qishu,$res['bet'],$res['colums'],$res['bets'][$i],$uid[$i]);}
                        }
                    }else{
                        $uid=$this->id2();
                        for($i=0;$i<sizeof($uid);$i++){
                        $zongbiao = model("ordered")->findandicapqishuzhonglei($zhanghao,$stime2,$etime2,$qishu,$res['bet'],$res['colums'],$uid[$i]);}
                        // mp($zongbiao);
                    }
                }
            }
        }
        if($type==2){
            if(empty($zhanghao)){return 0;}
            $a = model('ordered')->takedanhao($zhanghao);
            // mp($a);
        }
        if($type==1){
            // mp($type);
            if($zhonglei==0){
                // mp($zhonglei);
            if($qishu==0){
                        // mp($qishu);
                        $uid = $this->id2(); 
                        $id = model("user")->findallsbo($zhanghao);
                        if(in_array($id,$uid)){
                        foreach($uid as $k1 => $item){
                                $zongbiao = model("ordered")->finduserid($item,$stime2,$etime2);
                        }       
                        // mp($zongbiao);         
                        $this->assign("zongbiao", $zongbiao);
                    }else{$this->error('无权限');}                
            }else{
                        $uid = $this->id2();
                        $id = model("user")->findallsbo($zhanghao);
                        if(in_array($id,$uid)){
                        foreach($uid as $k1 => $item){
                            $zongbiao = model("ordered")->finduseridqishu($item,$stime2,$etime2,$qishu);
                        }
                        // mp($zongbiao);
                        $this->assign("zongbiao", $zongbiao);
                        }else{$this->error('无权限');}
                }
            }else{
                if($qishu==0){
                    $res = $this->redckout($zhonglei);
                    if(!empty($res['bets'])){
                    $uid = $this->id2();
                    $id = model("user")->findallsbo($zhanghao);
                    if(in_array($id,$uid)){
                    foreach($uid as $k1 => $item){
                        $zongbiao = model("ordered")->finduseridzhongleibets($item,$stime2,$etime2,$res['bet'],$res['colums'],$res['bets'][$i]);
                    }
                    // mp($zongbiao);
                    $this->assign("zongbiao", $zongbiao);
                    }else{$this->error('无权限');} 
                    }else{
                        $uid = $this->id2();
                        $id = model("user")->findallsbo($zhanghao);
                        if(in_array($id,$uid)){
                        foreach($uid as $k1 => $item){
                            $zongbiao = model("ordered")->finduseridzhonglei($item,$stime2,$etime2,$res['bet'],$res['colums']);
                        }
                        // mp($zongbiao);
                        $this->assign("zongbiao", $zongbiao);
                        }else{$this->error('无权限');} 
                    }               
                }else{
                    $res = $this->redckout($zhonglei);
                    if(!empty($res['bets'])){
                    $uid = $this->id2();
                    $id = model("user")->findallsbo($zhanghao);
                    if(in_array($id,$uid)){
                    foreach($uid as $k1 => $item){
                        $zongbiao = model("ordered")->finduseridqishuzhongleibets($item,$stime2,$etime2,$qishu,$res['bet'],$res['colums'],$res['bets'][$i]);
                    }
                    // mp($zongbiao);
                    $this->assign("zongbiao", $zongbiao);
                    }else{$this->error('无权限');} 
                    }else{
                        $uid = $this->id2();
                        $id = model("user")->findallsbo($zhanghao);
                        if(in_array($id,$uid)){
                        foreach($uid as $k1 => $item){
                            $zongbiao = model("ordered")->finduseridqishuzhonglei($item,$stime2,$etime2,$qishu,$res['bet'],$res['colums']);
                        }
                        // mp($zongbiao);
                        $this->assign("zongbiao", $zongbiao);
                        }else{$this->error('无权限');} 
                    }
                }
            }
        }
        // mp($zongbiao);
        if(empty($zongbiao)){$this->error('查无此信息');}
        $this->assign("zongbiao", $zongbiao);
        // $this->assign('res',$res);
        return $this->fetch();
    }

    // 公告管理
    public function Notice()
    {
        if (!isset($_GET['status'])) {
            $status = 0;
        } else {
            $status = $_GET['status'];
        }
        if ($status == 0) {
            $result = model("Announce")->findall();
            foreach ($result as $key => $value) {
                $result[$key]["i"] = $key + 1;
            }
        }
        if ($status > 0) {
            $result = model("Announce")->findstatus($status);
            foreach ($result as $key => $value) {
                $result[$key]["i"] = $key + 1;
            }
        }
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('result', $result);
        $this->assign('s', $status);
        return $this->fetch();
    }
    // 公告修改
    public function updatenotice(){
        if (request()->isGet()) {
            $id = $_GET['id'];
            $res = model('announce')->findid($id);
            $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
            $this->assign('res', $res);
            return $this->fetch();
        }
        $id = $_POST['id'];
        $res['content'] = $_POST['content'];
        $res['status'] = $_POST['status'];
        model('announce')->where('id', $id)->update($res);
        return $this->redirect("admin/home/Notice");
    }
    //找当前期数
    public function dangqianqishu(){
        $datatime = 0;
        $opent = model('openplate')->findall();
        foreach($opent as $ky => $o){
            if(time() >= $o['opentime'] && time() <= $o['tclosetime']){
                $datatime = $o['datetime'];
            }
        }
        return $datatime;
    }
    //根据盘口，bet，colums，id链，期数找注单
    public function quanbuzhudan($panlei,$bet,$colums,$item,$datatime){
        $uid=$this->id2();//id链
        foreach($uid as $key => $item){
            $res = model('ordered')->findjishizonge($panlei,$bet,$colums,$item,$datatime);//特码A的全部注单
        }
        return $res;
    }
    
    public function replenish(){
        $datatime = $this->dangqianqishu();
        // $datatime = 202;
        $resZhengma = model("rate")->findsZhengmaRate();//正码赔率      
        $resultTema = model("rate")->findTemaRate();//特码赔率
        $announce = model('announce')->findstatus(2);
        $this->assign('resZhengma', $resZhengma);//赔率
        $this->assign('resultTema',$resultTema);//赔率
        $this->assign('datatime',$datatime);//期数
        $this->assign('announce',$announce);//广告
        return $this->fetch();
    }
    // 补货新表
    function replenishment($andicap=1,$type=1,$upd=0,$status=1){
        // type=1 全部 2实货  3是成数 4是收补 5是补货 6实+补
        $timeinterval = $this->timeinterval();
        if($timeinterval==1){
            $opentime = 1;
        }else{        
            $opentime = $timeinterval['opentime'];
        }
        // mp1($opentime);
        $datatime = $this->dangqianqishu();
        $announce = model('announce')->findstatus(2);
        $ids = $this->id();
        if($datatime==0){
           $datatime = "没开盘";             
        }else{
           if($status==1){
                // 特码
                foreach ($ids['u7'] as $key => $va) {
                    $res[] = model('ordered')->fuids($andicap,1,1,$va,$datatime,session('adminid'));
                }
                    $bet = 1;$colums=1;$bets=1;

            }else if($status==2){
                // 正一特
                foreach ($ids['u7'] as $key => $va) {
                    $res[] = model('ordered')->fuids($andicap,3,1,$va,$datatime,session('adminid'));
                }
                $bet = 3;$colums=1;$bets=1;
            }else if($status==3){
                // 正二特
                foreach ($ids['u7'] as $key => $va) {
                    $res[] = model('ordered')->fuids($andicap,3,2,$va,$datatime,session('adminid'));
                }
                $bet = 3;$colums=2;$bets=1;
            }else if($status==4){
                // 正三特
                foreach ($ids['u7'] as $key => $va) {
                    $res[] = model('ordered')->fuids($andicap,3,3,$va,$datatime,session('adminid'));
                }
                $bet = 3;$colums=3;$bets=1;
            }else if($status==5){
                // 正四特
               foreach ($ids['u7'] as $key => $va) { 
                    $res[] = model('ordered')->fuids($andicap,3,4,$va,$datatime,session('adminid'));
                }
                $bet = 3;$colums=4;$bets=1;
            }else if($status==6){
                // 正五特
                foreach ($ids['u7'] as $key => $va) {
                    $res[] = model('ordered')->fuids($andicap,3,5,$va,$datatime,session('adminid'));
                }
                $bet = 3;$colums=5;$bets=1;
            }else if($status==6){
                // 正六特
                foreach ($ids['u7'] as $key => $va) {
                    $res[] = model('ordered')->fuids($andicap,3,6,$va,$datatime,session('adminid'));
                }
                $bet = 3;$colums=6;$bets=1;
            } 
        }
        $data = getpancha($andicap,$bet,$colums,$bets);
        $data = json_decode($data,true);
        $pancha = model('pancha')->findandicap($data["id"],$data['n']);
        $rate = model('rate')->where(['bet'=>$bet])->where(['colums'=>$colums])->where('bets','<',50)->select();
        // mp($res);
        $arr = [];

        // 是所有下级的订单实货
        if(session('usertype')==1){
            for($i=1;$i<=49;$i++){
                $arr[$i]['sh'] = 0;
                $arr[$i]['sb'] = 0;
                $arr[$i]['bh'] = 0;
                $arr[$i]['sandb'] = 0;
                $arr[$i]['num'] = $i;
                for($j=0;$j<count($res);$j++){
                   foreach ($res[$j] as $k1 => $v1) {
                        if($v1['bets']==$i){
                            $arr[$i]['sh'] += $v1['price']*$v1['houtai']/100.0;
                            $arr[$i]['cs'] = $v1['houtai'];
                            $arr[$i]['sb'] = $v1['sb'];
                            $arr[$i]['bh'] = $v1['bh'];
                            $arr[$i]['sandb'] = $arr[$i]['sb']+$arr[$i]['sh']-$v1['bh'];
                        }
                    } 
                }
            }
        }else if(session('usertype')==2){
           for($i=1;$i<=49;$i++){
                $arr[$i]['sh'] = 0;
                $arr[$i]['sb'] = 0;
                $arr[$i]['bh'] = 0;
                $arr[$i]['sandb'] = 0;
                $arr[$i]['num'] = $i;
                for($j=0;$j<count($res);$j++){
                   foreach ($res[$j] as $k1 => $v1) {
                        if($v1['bets']==$i){
                            $arr[$i]['num'] = $v1['bets'];
                            $arr[$i]['sh'] += $v1['price']*$v1['zongjian']/100.0;
                            $arr[$i]['cs'] = $v1['zongjian'];
                            $arr[$i]['sb'] = $v1['sb'];
                            $arr[$i]['bh'] = $v1['bh'];
                            $arr[$i]['sandb'] = $arr[$i]['sb']+$arr[$i]['sh']-$v1['bh'];
                        }
                    } 
                }
            }
        }else if(session('usertype')==3){
            for($i=1;$i<=49;$i++){
                $arr[$i]['sh'] = 0;
                $arr[$i]['sb'] = 0;
                $arr[$i]['bh'] = 0;
                $arr[$i]['sandb'] = 0;
                $arr[$i]['num'] = $i;
                for($j=0;$j<count($res);$j++){
                   foreach ($res[$j] as $k1 => $v1) {
                        if($v1['bets']==$i){
                            $arr[$i]['num'] = $v1['bets'];
                            $arr[$i]['sh'] += $v1['price']*$v1['dagudong']/100.0;
                            $arr[$i]['cs'] = $v1['dagudong'];
                            $arr[$i]['sb'] = $v1['sb'];
                            $arr[$i]['bh'] = $v1['bh'];
                            $arr[$i]['sandb'] = $arr[$i]['sb']+$arr[$i]['sh']-$v1['bh'];
                        }
                    } 
                }
            }
        }else if(session('usertype')==4){
            for($i=1;$i<=49;$i++){
                $arr[$i]['sh'] = 0;
                $arr[$i]['sb'] = 0;
                $arr[$i]['bh'] = 0;
                $arr[$i]['sandb'] = 0;
                $arr[$i]['num'] = $i;
                for($j=0;$j<count($res);$j++){
                   foreach ($res[$j] as $k1 => $v1) {
                        if($v1['bets']==$i){
                            $arr[$i]['num'] = $v1['bets'];
                            $arr[$i]['sh'] += $v1['price']*$v1['gudong']/100.0;
                            $arr[$i]['cs'] = $v1['gudong'];
                            $arr[$i]['sb'] = $v1['sb'];
                            $arr[$i]['bh'] = $v1['bh'];
                            $arr[$i]['sandb'] = $arr[$i]['sb']+$arr[$i]['sh']-$v1['bh'];
                        }
                    } 
                }
            }
        }else if(session('usertype')==5){
            for($i=1;$i<=49;$i++){
                $arr[$i]['sh'] = 0;
                $arr[$i]['sb'] = 0;
                $arr[$i]['bh'] = 0;
                $arr[$i]['sandb'] = 0;
                $arr[$i]['num'] = $i;
                for($j=0;$j<count($res);$j++){
                   foreach ($res[$j] as $k1 => $v1) {
                        if($v1['bets']==$i){
                            $arr[$i]['num'] = $v1['bets'];
                            $arr[$i]['sh'] += $v1['price']*$v1['zongdai']/100.0;
                            $arr[$i]['cs'] = $v1['zongdai'];
                            $arr[$i]['sb'] = $v1['sb'];
                            $arr[$i]['bh'] = $v1['bh'];
                            $arr[$i]['sandb'] = $arr[$i]['sb']+$arr[$i]['sh']-$v1['bh'];
                        }
                    } 
                }
            }
        }else if(session('usertype')==6){
            for($i=1;$i<=49;$i++){
                $arr[$i]['sh'] = 0;
                $arr[$i]['sb'] = 0;
                $arr[$i]['bh'] = 0;
                $arr[$i]['sandb'] = 0;
                $arr[$i]['num'] = $i;
                for($j=0;$j<count($res);$j++){
                   foreach ($res[$j] as $k1 => $v1) {
                        if($v1['bets']==$i){
                            $arr[$i]['num'] = $v1['bets'];
                            $arr[$i]['sh'] += $v1['price']*$v1['daili']/100.0;
                            $arr[$i]['cs'] = $v1['daili'];
                            $arr[$i]['sb'] = $v1['sb'];
                            $arr[$i]['bh'] = $v1['bh'];
                            $arr[$i]['sandb'] = $arr[$i]['sb']+$arr[$i]['sh']-$v1['bh'];
                        }
                    } 
                }
            }
        }
        foreach ($rate as $s1 => $z1) {
           for ($i=1; $i <count($arr)+1 ; $i++) { 
                   if($arr[$i]['num']==$z1['bets']){
                        $arr[$i]['rate']=$rate[$s1]['ra']+$pancha;
                        $arr[$i]['yk'] = $arr[$i]['sandb']-$arr[$i]['rate']*$arr[$i]['sandb'];
                   }
               }
        }
        // if($type==0){
        //    foreach ($arr as $k => $v) {
        //       $num[] = $v['num'];
        //     }
        //     array_multisort($num, SORT_ASC , $arr); 
        // }else if($type==1){
        //    foreach ($arr as $k => $v) {
        //       $sh[] = $v['sh'];
        //     }
        //     array_multisort($sh, SORT_DESC , $arr); 
        // }else if($type==2){
        //    foreach ($arr as $k => $v) {
        //       $cs[] = $v['cs'];
        //     }
        //     array_multisort($cs, SORT_DESC , $arr); 
        // }else if($type==3){
        //    foreach ($arr as $k => $v) {
        //       $sb[] = $v['sb'];
        //     }
        //     array_multisort($sb, SORT_DESC , $arr); 
        // }else if($type==4){
        //    foreach ($arr as $k => $v) {
        //       $bh[] = $v['bh'];
        //     }
        //     array_multisort($bh, SORT_DESC , $arr); 
        // }else if($type==5){
        //    foreach ($arr as $k => $v) {
        //       $sandb[] = $v['sandb'];
        //     }
        //     array_multisort($sandb, SORT_DESC , $arr); 
        // }
        $datatime = $this->dangqianqishu();
        $this->assign('datatime',$datatime);
        $this->assign('status',$status);
        $this->assign('type',$type);
        $this->assign('upd',$upd);
        $this->assign('andicap',$andicap);
        $this->assign('arr',$arr);
        // mp($arr);
        $this->assign('datatime',$datatime);//期数
        $this->assign('announce',$announce);//广告
        $this->assign('opentime',$opentime);
        return $this->fetch();
    }
    // 补货
    // public function replenishment($price=0,$panlei=0,$betandcolums=0,$bets=0,$check=0) {
    //         $price = $_GET["price"];
    //         $panlei = $_GET["panlei"];
    //         $betandcolums = $_GET["betandcolums"];
    //         $bets= $_GET["bets"];
    //         $check = $_GET["check"];
    //         $datatime = $this->dangqianqishu();
    //         // $datatime = 202;
    //         $xiazhuuid = 2;//待定
    //         $upoccupy = action('admin/single/zhaoupoccupy');
    //         $uid=$this->id2();//id链s
    //         if($panlei==0){$panlei=1;}
    //         switch($betandcolums){

    //             case 0:
    //             $bet = 1;
    //             $colums = 1;
    //             $res = $this->quanbuzhudan($panlei,$bet,$colums,$item,$datatime);//全部注单
    //             // mp($res);
    //             break;

    //             case 1:
    //             $bet = 4;
    //             $colums = 1;
    //             $res=model('ordered')->findzheng1te($panlei,$bet,$colums,$item,$datatime);
    //             // mp($res);
    //             break;

    //             case 2:
    //             $bet = 4;
    //             $colums = 1;
    //             $res=model('ordered')->findzheng2te($panlei,$bet,$colums,$item,$datatime);
    //             break;

    //             case 3:
    //             $bet = 4;
    //             $colums = 1;
    //             $res=model('ordered')->findzheng3te($panlei,$bet,$colums,$item,$datatime);
    //             break;

    //             case 4:
    //             $bet = 4;
    //             $colums = 1;
    //             $res=model('ordered')->findzheng4te($panlei,$bet,$colums,$item,$datatime);
    //             break;

    //             case 5:
    //             $bet = 4;
    //             $colums = 1;
    //             $res=model('ordered')->findzheng5te($panlei,$bet,$colums,$item,$datatime);
    //             break;

    //             case 6:
    //             $bet = 4;
    //             $colums = 1;
    //             $res=model('ordered')->findzheng6te($panlei,$bet,$colums,$item,$datatime);
    //             break;
    //         }
    //         $topuser1 = model('user')->findtop(session("adminid"));
    //         $topuser=$topuser1['topuser'];
    //         // mp1($res);
    //         if(empty($res)){
    //             return $this->redirect("admin/home/replenish");
    //         }
    //         $zongjine = action('admin/single/zongjine',[$res]);//特码总金额
    //         // mp($zongjine);
    //         $new = action('admin/single/betzhudan',[$res]);//特码的1-49号球的注单以及特码三双大小那些
    //         // mp($new);
    //         $a = array_keys($new);//提取数组下标
    //         $bishu = action('admin/single/bishuc0',[$new]);
    //         $buhuo = action('admin/single/buhuoc0',[$new]);//补货
    //         $bishu2 = array_combine($a,$bishu);
    //         $zongbishu = action('admin/single/zongbishu',[$bishu2]);//总笔数 
    //         switch($check){
    //             case 0://查看全部
    //                 $yingkui = action('admin/single/yingkuic0',[$new,$zongjine]);
    //                 $jine = action('admin/single/jinec0',[$new]);
    //                 // mp1($jine);
    //                 // mp1($yingkui);
    //                 // mp1($buhuo);
    //                 // mp1($bishu2);
    //                 // mp1($zongbishu);                
    //                 $this->assign('zongbishu',$zongbishu);//总笔数
    //                 $this->assign('jine',$jine);//金额
    //                 $this->assign('yingkui',$yingkui);//盈亏
    //                 $this->assign('bishu',$bishu2);//笔数
    //                 $this->assign('buhuo',$buhuo);//补货
    //             break;
    //             case 1://查看实货就是成数减去自己补货出去的
    //                 $jine = action('admin/single/jinec1',[$new,$upoccupy]);
    //                 $yingkui = action('admin/single/yingkuic1',[$new,$zongjine,$upoccupy]);
    //                 // mp1($jine);
    //                 // mp1($yingkui);
    //                 // mp1($buhuo);
    //                 // mp1($bishu2);
    //                 // mp1($zongbishu);                
    //                 $this->assign('zongbishu',$zongbishu);//总笔数
    //                 $this->assign('jine',$jine);//金额
    //                 $this->assign('yingkui',$yingkui);//盈亏
    //                 $this->assign('bishu',$bishu2);//笔数
    //                 $this->assign('buhuo',$buhuo);//补货
    //             break;
    //             case 2://查看成数
    //                 $jine = action('admin/single/jinec2',[$new,$upoccupy]);
    //                 $yingkui = action('admin/single/yingkuic2',[$new,$zongjine,$upoccupy]);
    //                 // mp1($jine);
    //                 // mp1($yingkui);
    //                 // mp1($buhuo);
    //                 // mp1($bishu2);
    //                 // mp1($zongbishu);
    //                 $this->assign('zongbishu',$zongbishu);//总笔数
    //                 $this->assign('jine',$jine);//金额
    //                 $this->assign('yingkui',$yingkui);//盈亏
    //                 $this->assign('bishu',$bishu2);//笔数
    //                 $this->assign('buhuo',$buhuo);//补货  
    //                 // mp("1"); 
    //             break;
    //             case 3://查看收补，看下级补货上来的 金额就是buhuo
    //                 $jine = action('admin/single/jinec3',[$new]);
    //                 $buhuo = action('admin/single/xiajibuhuo',[$new]);
    //                 $yingkui = action('admin/single/yingkuic3',[$new,$zongjine]);
    //                 // mp1($jine);
    //                 // mp1($yingkui);
    //                 // mp1($buhuo);
    //                 // mp1($bishu2);
    //                 // mp1($zongbishu);                
    //                 $this->assign('zongbishu',$zongbishu);//总笔数
    //                 $this->assign('jine',$jine);//金额
    //                 $this->assign('yingkui',$yingkui);//盈亏
    //                 $this->assign('bishu',$bishu2);//笔数
    //                 $this->assign('buhuo',$buhuo);//补货  
    //                 // mp("1");      
    //             break;
    //             case 4://查看补货，自己补货出去 这里补货就是金额
    //                 $jine = action('admin/single/jinec4',[$new]);
    //                 $yingkui = action('admin/single/yingkuic4',[$new,$zongjine]);
    //                 // mp1($jine);
    //                 // mp1($yingkui);
    //                 // mp1($buhuo);
    //                 // mp1($bishu2);
    //                 // mp1($zongbishu);               
    //                 $this->assign('zongbishu',$zongbishu);//总笔数
    //                 $this->assign('jine',$jine);//金额
    //                 $this->assign('yingkui',$yingkui);//盈亏
    //                 $this->assign('bishu',$bishu2);//笔数
    //                 $this->assign('buhuo',$buhuo);//补货  
    //                 // mp("1");
    //             break;
    //             case 5://查看实加外，实货加补货
    //                 $jine = action('admin/single/jinec5',[$new,$upoccupy]);
    //                 $yingkui = action('admin/single/yingkuic5',[$new,$zongjine,$upoccupy]);
    //                 // mp1($jine);
    //                 // mp1($yingkui);
    //                 // mp1($buhuo);
    //                 // mp1($bishu2);
    //                 // mp1($zongbishu);                
    //                 $this->assign('zongbishu',$zongbishu);//总笔数
    //                 $this->assign('jine',$jine);//金额
    //                 $this->assign('yingkui',$yingkui);//盈亏
    //                 $this->assign('bishu',$bishu2);//笔数
    //                 $this->assign('buhuo',$buhuo);//补货
    //             break;
    //         }

    //         $data = [
    //             'user_id' => session(adminid), 'topuser' => $topuser,'andicap'=>$panlei,'bet'=>$bet,'colums'=>$colums,'bets'=>$bets,'price'=> 0,'datatime'=>$datatime,'xiazhuid'=>$xiazhuuid,'zidongbuhuo'=>0,'zijibuhuo'=>$price,'upoccupy'=>$upoccupy
    //         ];
    //         $m=0;
    //         for($i=0;$i<count($res);$i++){
    //             $m +=$res[$i]['price']; 
    //         }
    //         $m*=$upoccupy;
    //         if(!empty($price)&&$price<$m){
    //             Db('buhuo') -> insert($data);
    //         }
            
    //         $announce = model('announce')->findstatus(2);
    //         $this->assign('zongjine',$zongjine);//总价
    //         $this->assign('resZhengma', $resZhengma);//赔率
    //         $this->assign('resultTema',$resultTema);//赔率
    //         $this->assign('res',$res);//全部符合条件的注单
    //         $this->assign('zongjine',$zongjine);//总价
    //         $this->assign('datatime',$datatime);//期数
    //         $this->assign('announce',$announce);//广告
    //         return $this->fetch();
    // }
    // 客服
    public function fot() {
        if (!isset($_GET['status'])) {
            $status = 88;
        } else {
            $status = $_GET['status'];
        }
        if ($status == 88) {
            $result = model("kefu")->findall();
        }
        if ($status != 88) {
            $result = model("kefu")->findstatus($status);
        }
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('result', $result);
        $this->assign('s', $status);
        return $this->fetch();
    }
    public function findfot($type) {
        $result = model("kefu")->findtype($type);
        // mp($result);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('result', $result);
        return $this->fetch('fot');
    }
    // 客服回复
    public function answer($id) {
        $res = model('kefu')->findid($id);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res', $res);
        return $this->fetch();
    }
    function inserstr($str){
        // 对数据库的数字进行装换成字符串
        $str .="";
        return $str;
    }
    function jisuannumber($num){
        $r = [];
        // 计算是否数字内容
        $nums = $num."";
        $arr = str_split($nums, 1);
        if (count($arr) > 1) {
                $arr0 = intval($arr[0]);
                $arr1 = intval($arr[1]);
                if($num!=49){
                   if (($arr1 + $arr0) % 2 == 0) {
                    $r['hds'] = "双";
                    } else {
                        $r['hds'] = "单";
                    }
                    if (($arr1 + $arr0) > 6) {
                        $r['hdx'] = "大";
                    } else {
                        $r['hdx'] = "小";
                    }
                    if($arr1>6){
                        $r['wdx'] = "大";
                    }else{
                        $r['wdx'] = "小";
                    }
                    for ($i=0; $i <10 ; $i++) { 
                        if($arr1==$i){
                            $r['ws'] = $i;
                        }
                    }
                     for ($i=0; $i <10 ; $i++) { 
                        if($arr0==$i){
                            $r['ts'] = $i;
                        }
                    } 
                }else{
                        $r['hds'] = "和";
                        $r['hdx'] = "和";
                        $r['wdx'] = "和";
                    for ($i=0; $i <10 ; $i++) { 
                        if($arr1==$i){
                            $r['ws'] = $i;
                        }
                    }
                     for ($i=1; $i <10 ; $i++) { 
                        if($arr0==$i){
                            $r['ts'] = $i;
                        }
                    } 
                }

            } else {
                $arr1 = intval($arr[0]);
                if (($arr1) % 2 == 0) {
                    $r['hds'] = "双";
                } else {
                    $r['hds'] = "单";
                }
                if (($arr1) > 6) {
                    $r['hdx'] = "大";
                }else {
                    $r['hdx'] = "小";
                }
                if($arr1>6){
                    $r['wdx'] = "大";
                }else{
                    $r['wdx'] = "小";
                }
                 for ($i=0; $i <10 ; $i++) { 
                    if($arr1==$i){
                        $r['ws'] = $i;
                    }
                }
                $r['ts'] = 0;
            }
            if ($num % 2 == 0) {
                $r['ds'] = "双";
            } else {
                $r['ds'] = "单";
            }
            if ($num == 1 || $num == 2 || $num == 7 || $num == 8 || $num == 12 || $num == 13 || $num == 18 || $num == 19 || $num == 23 || $num == 24 || $num == 29 || $num == 30 || $num == 34 || $num == 35 || $num == 40 || $num == 45 || $num == 46) {
                $r['sb'] = "红";
            } else if ($num == 5 || $num == 6 || $num == 11 || $num == 16 || $num == 17 || $num == 21 || $num == 22 || $num == 27 || $num == 28 || $num == 32 || $num == 33 || $num == 38 || $num == 39 || $num == 43 || $num == 44 || $num == 49) {
                $r['sb'] = "绿";
            } else {
                $r['sb'] = "蓝";
            }
            $z7 = getSSNameByNum($num);
            $r['sx'] = $z7;
            if ($num > 24 && $num!=49) {
                $r['dx'] = "大";
            } else if($num ==49){
                $r['dx'] = "和";
            } else{
                $r['dx'] = "小";
            }
            $r= json_encode($r);
            return $r;
    }
    function weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,$num,$str){
        if($str=="中"){
             if (count($arr1) > 1) {
                            // mp($arr1);
                        $a1 = intval($arr1[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr1[0]);
                            if($a1==$num) {return 1;}
                        } 

                        if (count($arr2) > 1) {
                            // mp($arr2);
                            $a1 = intval($arr2[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr2[0]);
                            if($a1==$num) {return 1;}
                        }
                            // mp($arr3);

                        if (count($arr3) > 1) {
                            $a1 = intval($arr3[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr3[0]);
                            if($a1==$num) {return 1;}
                        }

                        if (count($arr4) > 1) {
                            // mp($arr4);
                            $a1 = intval($arr4[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr4[0]);
                            if($a1==$num) {return 1;}
                        }

                        if (count($arr5) > 1) {
                            // mp($arr5);
                            $a1 = intval($arr5[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr5[0]);
                            if($a1==$num) {return 1;}
                        }

                        if (count($arr6) > 1) {
                            // mp($arr6);
                            $a1 = intval($arr6[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr6[0]);
                            if($a1==$num) {return 1;}
                        }

                        if (count($arr7) > 1) {
                            // mp($arr7);
                            $a1 = intval($arr7[1]);
                            if($a1==$num) {return 1;}
                        } else {
                            $a1 = intval($arr7[0]);
                            if($a1==$num) {return 1;}
                        }
                       return 0; 
        }
        if($str=="不中"){
                        if (count($arr1) > 1) {
                            // mp($arr1);
                            $a1 = intval($arr1[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr1[0]);
                            if($a1==$num) {return 0;}
                        } 

                        if (count($arr2) > 1) {
                            // mp($arr2);
                            $a1 = intval($arr2[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr2[0]);
                            if($a1==$num) {return 0;}
                        }
                            // mp($arr3);

                        if (count($arr3) > 1) {
                            $a1 = intval($arr3[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr3[0]);
                            if($a1==$num) {return 0;}
                        }

                        if (count($arr4) > 1) {
                            // mp($arr4);
                            $a1 = intval($arr4[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr4[0]);
                            if($a1==$num) {return 0;}
                        }

                        if (count($arr5) > 1) {
                            // mp($arr5);
                            $a1 = intval($arr5[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr5[0]);
                            if($a1==$num) {return 0;}
                        }

                        if (count($arr6) > 1) {
                            // mp($arr6);
                            $a1 = intval($arr6[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr6[0]);
                            if($a1==$num) {return 0;}
                        }

                        if (count($arr7) > 1) {
                            // mp($arr7);
                            $a1 = intval($arr7[1]);
                            if($a1==$num) {return 0;}
                        } else {
                            $a1 = intval($arr7[0]);
                            if($a1==$num) {return 0;}
                        }
                       return 1; 
                    }
    }
    function zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$str){
        // echo ($Zone.",".$Ztwo.",".$Zthree.",".$Zfour.",".$Zfive.",".$Zsix.",".$str);
        // exit();
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $res = [$Z1["sx"],$Z2["sx"],$Z3["sx"],$Z4["sx"],$Z5["sx"],$Z6["sx"]];
            $res = array_count_values($res);
            $num = 0;
            foreach ($res as $key => $value) {
                    if($key==$str){
                        $num = $res[$key];
                    }
                }
            return $num;
    }
    function wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str){
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z7 = $this->jisuannumber($Zseven);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $Z7 = json_decode($Z7,true);
            $res = [$Z1["ws"],$Z2["ws"],$Z3["ws"],$Z4["ws"],$Z5["ws"],$Z6["ws"],$Z7['ws']];
            foreach ($res as $key => $v) {
                if($v==$str){
                    return 1;
                }
            }
            return 0;
    }
    function lxp($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str,$num){
        // 连肖
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z7 = $this->jisuannumber($Zseven);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $Z7 = json_decode($Z7,true);
            $str = explode(',',$str); 
            foreach ($str as $k => $v) {
                $ss = getSSNameByNum($v);
                $strs[] = $ss;
            }
            $res = [$Z1["sx"],$Z2["sx"],$Z3["sx"],$Z4["sx"],$Z5["sx"],$Z6["sx"],$Z7['sx']];
            $res = array_count_values($res);
            $r = 0;
            if($num=="1"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=3){
                    return 1;
                }else{
                    return 0;
                }
            }
            if($num=="2"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=4){
                    return 1;
                }else{
                    return 0;
                }
            }
            if($num=="3"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=5){
                    return 1;
                }else{
                    return 0;
                }
            }
            if($num=="4"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=6){
                    return 1;
                }else{
                    return 0;
                }
            }
    }
    function dxp($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str,$num){
        // 多肖
            $strs = [];
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z7 = $this->jisuannumber($Zseven);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $Z7 = json_decode($Z7,true);
            $str = explode(',',$str); 
            foreach ($str as $k => $v) {
                $ss = getSSNameByNum($v);
                $strs[] = $ss;
            }
            $res = [$Z1["sx"],$Z2["sx"],$Z3["sx"],$Z4["sx"],$Z5["sx"],$Z6["sx"],$Z7['sx']];
            $res = array_count_values($res);
            $r = 0;
            if($num=="2"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=2){
                    return 1;
                }else{
                    return 0;
                }
            }
            if($num=="3"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=3){
                    return 1;
                }else{
                    return 0;
                }
            }
            if($num=="4"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=4){
                    return 1;
                }else{
                    return 0;
                }
            }
            if($num=="5"){
                foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($strs);$i++){
                        if($strs[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=5){
                    return 1;
                }else{
                    return 0;
                }
            }
    }
    function yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str,$num=1){
        $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z7 = $this->jisuannumber($Zseven);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $Z7 = json_decode($Z7,true);
        if($num==1){
             $res = [$Z1["sx"],$Z2["sx"],$Z3["sx"],$Z4["sx"],$Z5["sx"],$Z6["sx"],$Z7['sx']];
            foreach ($res as $key => $value) {
                if($str==$res[$key]){
                    return 1;
                }
            }
            return 0;
        }
        if($num==2){
            $res = [$Z1["sx"],$Z2["sx"],$Z3["sx"],$Z4["sx"],$Z5["sx"],$Z6["sx"],$Z7['sx']];
            foreach ($res as $key => $value) {
                if($str==$res[$key]){
                    return 0;
                }
            }
            return 1; 
        }
           
    }
    function tm($Zseven,$str,$num){
        $Z7 = $this->jisuannumber($Zseven);
        $Z7 = json_decode($Z7,true);
        if($str=="鼠"||$str=="牛"||$str=="虎"||$str=="兔"||$str=="龙"||$str=="蛇"||$str=="马"||$str=="羊"||$str=="猴"||$str=="鸡"||$str=="狗"||$str=="猪"){
             if($num==$Z7['sx']){
                return 1;
             }else{
                return 0;
             }  
        }
        if($str=="ts"){
            if($num==$Z7['ts']){
                return 1;
            }else{
                return 0;
            }
        }
        if($str=="ws"){
             if($num==$Z7['ws']){
                return 1;
            }else{
                return 0;
            }
        }
        if($str=="sb"){
             if($num==$Z7['sb']){
                return 1;
            }else{
                return 0;
            }
        }
    }
    function qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str){
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z7 = $this->jisuannumber($Zseven);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $Z7 = json_decode($Z7,true);
            $res = [$Z1["sb"],$Z2["sb"],$Z3["sb"],$Z4["sb"],$Z5["sb"],$Z6["sb"]];
            $res = array_count_values($res);
            if($Z7['sb']=="红")$res['红'] += 1.5;
            if($Z7['sb']=="蓝")$res['蓝'] += 1.5;
            if($Z7['sb']=="绿")$res['绿'] += 1.5;
            $max = -1;
            $maxkey ;
            foreach ($res as $key => $value) {
                    if($res[$key]>$max){
                        $max = $res[$key];
                        $maxkey = $key;
                    }
            }
            if($maxkey==$str)return 1;
            if($max==3&&$str=="和局")return 1;
            return 0;
    }
    function qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$str,$num){
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            if($str=="单"||$str="双"){
                $res = [$Z1["ds"],$Z2["ds"],$Z3["ds"],$Z4["ds"],$Z5["ds"],$Z6["ds"]];
                $res = array_count_values($res);
                foreach ($res as $k => $v1) {
                    if($k==$str){
                        if($v1==$num){
                            return 1;
                        }
                         return 0;
                    }else{
                        return 0;
                    }
                }
            }
            if($str=="大"||$str="小"){
                $res = [$Z1["dx"],$Z2["dx"],$Z3["dx"],$Z4["dx"],$Z5["dx"],$Z6["dx"]];
                $res = array_count_values($res);
                foreach ($res as $k1 => $v2) {
                    if($k1==$str){
                        if($v2==$num){
                            return 1;
                        }
                         return 0;
                    }else{
                        return 0;
                    }
                }
            }
    }
    function duozhongyi($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str,$cloums=3){
            $res = [$Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven];
            $str = explode(',',$str); 
            $r= 0;
             foreach ($res as $k1 => $v1) {
                    for($i=0;$i<count($str);$i++){
                        if($str[$i]==$k1){
                            $r++;
                        }
                    }
                }
                if($r>=$cloums){
                    return 1;
                }
                return 0;
    }
    function lm($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$str,$num){
            $str = explode(',',$str); 
            $res = [$Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix];
            $r = 0;
            $t = 0;
            foreach ($res as $k) {
               for($i=0;$i<count($str);$i++){
                    if($str[$i]==$res[$k]){
                        $r++;
                    }
                    if($str[$i]==$Zseven){
                        $t++;
                    }
               }
            }
            if($num==1){
                if($r>=3){
                   return 1;
                }
            }else if($num==2||$num==3){
                if($r>=3){
                   return 1;
                }else if($r==2){
                   return 2;
                }
            }else if($num==4){
                if($r>=2){
                   return 1;
                }
            }else if($num==5||$num==6){
                if($r>=2){
                   return 1;
                }else if($r==1&&$t==1){
                   return 2;
                }
            }else if($num==7){
                if($r==1&&$t==1){
                   return 1;
                }
            }else{
                return 0;
            }
    }
    function zmgg($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$bets){
        // 正码过关
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);

                    if($bets==1||$bets==14||$bets==27||$bets==40||$bets==53||$bets==66){
                        if($Zone==49)return 3;
                        if($bets==1){
                            if($Z1['dx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==14){
                            if($Z2['dx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==27){
                            if($Z3['dx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==40){
                            if($Z4['dx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==53){
                            if($Z5['dx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==66){
                            if($Z6['dx']=="大"){
                                return 1;
                            }
                        }
                        return 0;

                    } 
                    if($bets==2||$bets==15||$bets==28||$bets==41||$bets==54||$bets==67){
                        if($Ztwo==49)return 3;
                        if($bets==2){
                            if($Z1['dx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==15){
                            if($Z2['dx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==28){
                            if($Z3['dx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==41){
                            if($Z4['dx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==54){
                            if($Z5['dx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==67){
                            if($Z6['dx']=="小"){
                                return 1;
                            }
                        }
                        return 0;

                    } 
                    if($bets==3||$bets==16||$bets==29||$bets==42||$bets==55||$bets==68){
                        if($Zthree==49)return 3;

                        if($bets==3){
                            if($Z1['ds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==16){
                            if($Z2['ds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==29){
                            if($Z3['ds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==42){
                            if($Z4['ds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==55){
                            if($Z5['ds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==68){
                            if($Z6['ds']=="单"){
                                return 1;
                            }
                        } 
                        return 0;

                    } 
                    if($bets==4||$bets==17||$bets==30||$bets==43||$bets==56||$bets==69){
                        if($Zfour==49)return 3;

                        if($bets==4){
                            if($Z1['ds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==17){
                            if($Z2['ds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==30){
                            if($Z3['ds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==43){
                            if($Z4['ds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==56){
                            if($Z5['ds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==69){
                            if($Z6['ds']=="双"){
                                return 1;
                            }
                        }
                        return 0;

                    } 
                    if($bets==5||$bets==18||$bets==31||$bets==44||$bets==57||$bets==70){
                        if($Zfive==49)return 3;

                        if($bets==5){
                            if($Z1['sb']=="红"){
                                return 1;
                            }
                        }
                        if($bets==18){
                            if($Z2['sb']=="红"){
                                return 1;
                            }
                        }
                        if($bets==31){
                            if($Z3['sb']=="红"){
                                return 1;
                            }
                        }
                        if($bets==44){
                            if($Z4['sb']=="红"){
                                return 1;
                            }
                        }
                        if($bets==57){
                            if($Z5['sb']=="红"){
                                return 1;
                            }
                        }
                        if($bets==70){
                            if($Z6['sb']=="红"){
                                return 1;
                            }
                        } 
                        return 0;

                    } 
                    if($bets==6||$bets==19||$bets==32||$bets==45||$bets==58||$bets==71){
                        if($Zsix==49)return 3;
                        if($bets==6){
                            if($Z1['sb']=="蓝"){
                                return 1;
                            }
                        }
                        if($bets==19){
                            if($Z2['sb']=="蓝"){
                                return 1;
                            }
                        }
                        if($bets==32){
                            if($Z3['sb']=="蓝"){
                                return 1;
                            }
                        }
                        if($bets==45){
                            if($Z4['sb']=="蓝"){
                                return 1;
                            }
                        }
                        if($bets==58){
                            if($Z5['sb']=="蓝"){
                                return 1;
                            }
                        }
                        if($bets==71){
                            if($Z6['sb']=="蓝"){
                                return 1;
                            }
                        }
                        return 0;

                    } 
                    if($bets==7||$bets==20||$bets==33||$bets==46||$bets==59||$bets==72){
                        if($bets==7){
                            if($Z1['sb']=="绿"){
                                return 1;
                            }
                        }
                        if($bets==20){
                            if($Z2['sb']=="绿"){
                                return 1;
                            }
                        }
                        if($bets==33){
                            if($Z3['sb']=="绿"){
                                return 1;
                            }
                        }
                        if($bets==46){
                            if($Z4['sb']=="绿"){
                                return 1;
                            }
                        }
                        if($bets==59){
                            if($Z5['sb']=="绿"){
                                return 1;
                            }
                        }
                        if($bets==72){
                            if($Z6['sb']=="绿"){
                                return 1;
                            }
                        }  
                        return 0;

                    } 
                    if($bets==8||$bets==21||$bets==34||$bets==47||$bets==60||$bets==73){
                        if($bets==8){
                            if($Z1['hdx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==21){
                            if($Z2['hdx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==34){
                            if($Z3['hdx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==47){
                            if($Z4['hdx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==60){
                            if($Z5['hdx']=="大"){
                                return 1;
                            }
                        }
                        if($bets==73){
                            if($Z6['hdx']=="大"){
                                return 1;
                            }
                        } 
                        return 0;

                    }
                    if($bets==9||$bets==22||$bets==35||$bets==48||$bets==61||$bets==74){
                         if($bets==9){
                            if($Z1['hdx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==22){
                            if($Z2['hdx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==35){
                            if($Z3['hdx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==48){
                            if($Z4['hdx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==61){
                            if($Z5['hdx']=="小"){
                                return 1;
                            }
                        }
                        if($bets==74){
                            if($Z6['hdx']=="小"){
                                return 1;
                            }
                        }  
                        return 0;

                    }
                    if($bets==10||$bets==23||$bets==36||$bets==49||$bets==62||$bets==75){
                         if($bets==10){
                            if($Z1['hds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==23){
                            if($Z2['hds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==36){
                            if($Z3['hds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==49){
                            if($Z4['hds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==62){
                            if($Z5['hds']=="单"){
                                return 1;
                            }
                        }
                        if($bets==75){
                            if($Z6['hds']=="单"){
                                return 1;
                            }
                        } 
                        return 0;

                    }
                    if($bets==11||$bets==24||$bets==37||$bets==50||$bets==63||$bets==76){
                        if($bets==11){
                            if($Z1['hds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==24){
                            if($Z2['hds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==37){
                            if($Z3['hds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==50){
                            if($Z4['hds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==63){
                            if($Z5['hds']=="双"){
                                return 1;
                            }
                        }
                        if($bets==76){
                            if($Z6['hds']=="双"){
                                return 1;
                            }
                        }
                        return 0;

                    }
                    if($bets==12||$bets==25||$bets==38||$bets==51||$bets==64||$bets==77){
                         if($bets==11){
                            if($Z1['ws']>4){
                                return 1;
                            }
                        }
                        if($bets==24){
                            if($Z2['ws']>4){
                                return 1;
                            }
                        }
                        if($bets==37){
                            if($Z3['ws']>4){
                                return 1;
                            }
                        }
                        if($bets==50){
                            if($Z4['ws']>4){
                                return 1;
                            }
                        }
                        if($bets==63){
                            if($Z5['ws']>4){
                                return 1;
                            }
                        }
                        if($bets==76){
                            if($Z6['ws']>4){
                                return 1;
                            }
                        }
                        return 0;

                    }
                    if($bets==13||$bets==26||$bets==39||$bets==52||$bets==65||$bets==78){
                        if($bets==11){
                            if($Z1['ws']<5){
                                return 1;
                            }
                        }
                        if($bets==24){
                            if($Z2['ws']<5){
                                return 1;
                            }
                        }
                        if($bets==37){
                            if($Z3['ws']<5){
                                return 1;
                            }
                        }
                        if($bets==50){
                            if($Z4['ws']<5){
                                return 1;
                            }
                        }
                        if($bets==63){
                            if($Z5['ws']<5){
                                return 1;
                            }
                        }
                        if($bets==76){
                            if($Z6['ws']<5){
                                return 1;
                            }
                        }
                        return 0;
                    }
                return 0;
    }
    function zxnum($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix){
        // echo ($Zone.",".$Ztwo.",".$Zthree.",".$Zfour.",".$Zfive.",".$Zsix.",".$str);
        // exit();
            $Z1 = $this->jisuannumber($Zone);
            $Z2 = $this->jisuannumber($Ztwo);
            $Z3 = $this->jisuannumber($Zthree);
            $Z4 = $this->jisuannumber($Zfour);
            $Z5 = $this->jisuannumber($Zfive);
            $Z6 = $this->jisuannumber($Zsix);
            $Z1 = json_decode($Z1,true);
            $Z2 = json_decode($Z2,true);
            $Z3 = json_decode($Z3,true);
            $Z4 = json_decode($Z4,true);
            $Z5 = json_decode($Z5,true);
            $Z6 = json_decode($Z6,true);
            $res = [$Z1["sx"],$Z2["sx"],$Z3["sx"],$Z4["sx"],$Z5["sx"],$Z6["sx"]];
            $res = array_count_values($res);
            if($res){
               $num = count($res);
            }
            return $num;
    }
    function resultjiesuan($bet,$colums,$bets,$datatime){
        //  0不中 999为和 1为中  连码出现2是第二种可能

        $Zseven=0;$Zsix=0;$Zfive=0;$Zfour=0;$Ztwo=0;$Zone=0;$Zthree=0;
        $seven="";$six="";$five="";$four="";$two="";$one="";$three="";
        $s = model('result')->where('dataTime',$datatime)->find();
        $Zseven = (int)$s['Zseven'];
        $Zone = (int)$s['Zone'];
        $Ztwo = (int)$s['Ztwo'];
        $Zthree = (int)$s['Zthree'];
        $Zfour = (int)$s['Zfour'];
        $Zfive = (int)$s['Zfive'];
        $Zsix = (int)$s['Zsix'];

        $res = [$Zseven,$Zsix,$Zfive,$Zfour,$Ztwo,$Zthree,$Zone];
        $Zseven+=0;$Zsix+=0;$Zfive+=0;$Zfour+=0;$Ztwo+=0;$Zone+=0;$Zthree+=0;
        $one = $this->inserstr($Zone);
        $two = $this->inserstr($Ztwo);
        $three = $this->inserstr($Zthree);
        $four = $this->inserstr($Zfour);
        $five  = $this->inserstr($Zfive);
        $six = $this->inserstr($Zsix);
        $seven = $this->inserstr($Zseven);
        if($bet==1 && $bets<=49){
            if($bets == $Zseven){
                return 1;
            }else{
                return 0;
            }
        }
        if($bet==1 && $bets==50){
            // 特尾大
            if($Zseven == 49)return 3;
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr1 = intval($arr[1]);
                if($arr1 > 6){
                    return 1;
                }else{
                    return 0;
                }
            } else {
                $arr1 = intval($arr[0]);
                if($arr1 > 6){
                    return 1;
                }else{
                    return 0;
                }
            }
        }
        if($bet==1 && $bets==51){
            // 特尾小
            if($Zseven == 49)return 3;
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr1 = intval($arr[1]);
                if($arr1 < 6){
                    return 1;
                }else{
                    return 0;
                }
            } else {
                $arr1 = intval($arr[0]);
                if($arr1 < 6){
                    return 1;
                }else{
                    return 0;
                }
            }
        }
        if($bet==1 &&$bets==52){
            // 特单
            if($Zseven == 49)return 3;
            if($Zseven % 2 != 0){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==53){
            // 特双
            if($Zseven == 49)return 3;
            if($Zseven % 2 == 0){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==54){
            // 特大
            if($Zseven == 49)return 3;
            if( $Zseven >24 && $Zseven!=49 ){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==55){
            // 特小
            if($Zseven == 49)return 3;
            if( $Zseven <25 ){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==56){
            // 合双
            if($Zseven == 49)return 3;
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr0 = intval($arr[0]);

                $arr1 = intval($arr[1]);
                if(($arr1 + $arr0) % 2 == 0 ){
                    return 1;
                }else{
                    return 0;
                }
               
            } else {
                $arr1 = intval($arr[0]);
                if($arr1 % 2 == 0 ){
                    return 1;
                }else{
                    return 0;
                }
            }
        }
        if($bet==1 &&$bets==57){
            // 合单
            if($Zseven == 49)return 3;
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr0 = intval($arr[0]);

                $arr1 = intval($arr[1]);

                if(($arr1 + $arr0) % 2 != 0 ){
                    return 1;
                }else{
                    return 0;
                }
               
            } else {
                $arr1 = intval($arr[0]);
                if($arr1 % 2 != 0){
                    return 1;
                }else{
                    return 0;
                }
            }
        }
        if($bet==1 &&$bets==58){
            // 总单
            if(($Zseven+$Zsix+$Zfive+$Zfour+$Ztwo+$Zone+$Zthree) %2 != 0){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==59){
            // 总双
            if(($Zseven+$Zsix+$Zfive+$Zfour+$Ztwo+$Zone+$Zthree) %2 == 0){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==60){
            // 总大
            if(($Zseven+$Zsix+$Zfive+$Zfour+$Ztwo+$Zone+$Zthree) >174){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==61){
            // 总小
            
            if(($Zseven+$Zsix+$Zfive+$Zfour+$Ztwo+$Zone+$Zthree) <=174){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==62){
            // 红
            $Zseven += 0;
            
            if(($Zseven == 1 || $Zseven == 2 || $Zseven == 7 || $Zseven == 8 || $Zseven == 12 || $Zseven == 13 || $Zseven == 18 || $Zseven == 19 || $Zseven == 23 || $Zseven == 24 || $Zseven == 29 || $Zseven == 30 || $Zseven == 34 || $Zseven == 35 || $Zseven == 40 || $Zseven == 45 || $Zseven == 46)){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==63){
            // 绿
            $Zseven += 0;
            
            if(($Zseven == 5 || $Zseven == 6 || $Zseven == 11 || $Zseven == 16 || $Zseven == 17 || $Zseven == 21 || $Zseven == 22 || $Zseven == 27 || $Zseven == 28 || $Zseven == 32 || $Zseven == 33 || $Zseven == 38 || $Zseven == 39 || $Zseven == 43 || $Zseven == 44 || $Zseven == 49)){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==64){
            // 蓝
            $Zseven += 0;
            
            if(($Zseven == 3 || $Zseven == 4 || $Zseven == 9 || $Zseven == 10 || $Zseven == 14 || $Zseven == 15 || $Zseven == 20 || $Zseven == 25 || $Zseven == 26 || $Zseven == 31 || $Zseven == 36 || $Zseven == 37 || $Zseven == 41 || $Zseven == 42 || $Zseven == 47 || $Zseven == 48)){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==1 &&$bets==65){
            // 合大
            if($Zseven == 49)return 3;
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr0 = intval($arr[0]);

                $arr1 = intval($arr[1]);

                
                if(($arr1 + $arr0) >6 ){
                    return 1;
                }else{
                    return 0;
                }
               
            } else {
                $arr1 = intval($arr[0]);
                
                if($arr1 > 6 ){
                    return 1;
                }else{
                    return 0;
                }
            }
        }  
        if($bet==1 &&$bets==66){
            // 合小
            if($Zseven == 49)return 3;
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr0 = intval($arr[0]);

                $arr1 = intval($arr[1]);

                
                if(($arr1 + $arr0) <7 ){
                    return 1;
                }else{
                    return 0;
                }
               
            } else {
                $arr1 = intval($arr[0]);
                
                if($arr1 <7 ){
                    return 1;
                }else{
                    return 0;
                }
            }
        } 
        if($bet==1 &&$bets==67){
            // 大单
            if($Zseven == 49)return 3;
            
            if(($Zseven>24 && $Zseven%2!=0)){
                    return 1;
                }else{
                    return 0;
                }
        } 
        if($bet==1 &&$bets==68){
            // 大双
            if($Zseven == 49)return 3;
            
            if(($Zseven>24 && $Zseven%2==0)){
                    return 1;
                }else{
                    return 0;
                }
        } 
        if($bet==1 &&$bets==69){
            // 小单
            if($Zseven == 49)return 3;
            
            if(($Zseven<25 && $Zseven%2!=0)){
                    return 1;
                }else{
                    return 0;
                }
        } 
        if($bet==1 &&$bets==70){
            // 小双
            if($Zseven == 49)return 3;
            
            if(($Zseven<25 && $Zseven%2==0)){
                    return 1;
                }else{
                    return 0;
                }
        } 
        if($bet==2){
            //正码
            
            if(($Zsix ==$bets || $Zfive==$bets ||$Zfour==$bets ||$Ztwo==$bets ||$Zone==$bets ||$Zthree==$bets)){
                    return 1;
                }else{
                    return 0;
                }
        }
        if($bet==3){
            // 正码特0
            switch($colums){
                case 1://正1码
                   
                   if($Zone==$bets){
                    return 1;
                }else{
                    return 0;
                }
                break;
                case 2://正1码
                   
                   if($Ztwo==$bets){
                    return 1;
                }else{
                    return 0;
                }
                break;
                case 3://正1码
                   
                   if($Zthree==$bets){
                    return 1;
                }else{
                    return 0;
                }
                break;
                case 4://正1码
                  
                   if($Zfour==$bets){
                    return 1;
                }else{
                    return 0;
                }
                break;
                case 5://正1码
                   
                   if($Zfive==$bets){
                    return 1;
                }else{
                    return 0;
                }
                break;
                case 6://正1码
                   
                   if($Zsix==$bets){
                    return 1;
                }else{
                    return 0;
                }
                break;
                default:
                    return 0;
            }
        }
        if($bet==4){
            // 正码1-6
                switch ($bets) {
                    // 一
                    case 1:
                        if($Zone = 49)return 3;
                       
                        if( $Zone % 2 != 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 2:
                         if($Zone = 49)return 3;
                    
                    if($Zone % 2 == 0){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                      case 3:
                        if($Zone = 49)return 3;
                    
                    if($Zone >24 && $Zone!=49 ){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                      case 4:
                       if($Zone = 49)return 3;
                    
                    if($Zone <25){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                      case 5:
                       // 红
                    $Zone += 0;
                    
                    if(($Zone == 1 || $Zone == 2 || $Zone == 7 || $Zone == 8 || $Zone == 12 || $Zone == 13 || $Zone == 18 || $Zone == 19 || $Zone == 23 || $Zone == 24 || $Zone == 29 || $Zone == 30 || $Zone == 34 || $Zone == 35 || $Zone == 40 || $Zone == 45 || $Zone == 46)){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                      case 6:
                      $Zone += 0;
                    
                    if(($Zone == 3 || $Zone == 4 || $Zone == 9 || $Zone == 10 || $Zone == 14 || $Zone == 15 || $Zone == 20 || $Zone == 25 || $Zone == 26 || $Zone == 31 || $Zone == 36 || $Zone == 37 || $Zone == 41 || $Zone == 42 || $Zone == 47 || $Zone == 48)){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                      case 7:
                        $Zone += 0;
                    
                    if(($Zone == 5 || $Zone == 6 || $Zone == 11 || $Zone == 16 || $Zone == 17 || $Zone == 21 || $Zone == 22 || $Zone == 27 || $Zone == 28 || $Zone == 32 || $Zone == 33 || $Zone == 38 || $Zone == 39 || $Zone == 43 || $Zone == 44 || $Zone == 49)){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                      case 8:
                      // 合单
                        if($Zone = 49)return 3;
                        $arr = str_split($one, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 != 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                                       
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 != 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                        }
                    break;
                      case 9:
                      // 合双
                        if($Zone = 49)return 3;
                        $arr = str_split($one, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                           if(($arr1 + $arr0) % 2 == 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 == 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                        }
                    break;
                     // 二
                      case 10:
                        if($Ztwo = 49)return 3;
                        
                        if($Ztwo % 2 != 0){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 11:
                         if($Ztwo = 49)return 3;
                    
                    if($Ztwo % 2 == 0){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 12:
                        if($Ztwo = 49)return 3;
                    
                    if($Ztwo >24 && $Ztwo!=49 ){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 13:
                       if($Ztwo = 49)return 3;
                    
                    if($Ztwo <25){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 14:
                       // 红
                    $Ztwo += 0;
                    
                    if(($Ztwo == 1 || $Ztwo == 2 || $Ztwo == 7 || $Ztwo == 8 || $Ztwo == 12 || $Ztwo == 13 || $Ztwo == 18 || $Ztwo == 19 || $Ztwo == 23 || $Ztwo == 24 || $Ztwo == 29 || $Ztwo == 30 || $Ztwo == 34 || $Ztwo == 35 || $Ztwo == 40 || $Ztwo == 45 || $Ztwo == 46)){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 15:
                      $Ztwo += 0;
                    
                    if(($Ztwo == 3 || $Ztwo == 4 || $Ztwo == 9 || $Ztwo == 10 || $Ztwo == 14 || $Ztwo == 15 || $Ztwo == 20 || $Ztwo == 25 || $Ztwo == 26 || $Ztwo == 31 || $Ztwo == 36 || $Ztwo == 37 || $Ztwo == 41 || $Ztwo == 42 || $Ztwo == 47 || $Ztwo == 48)){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 16:
                        $Ztwo += 0;
                    
                    if(($Ztwo == 5 || $Ztwo == 6 || $Ztwo == 11 || $Ztwo == 16 || $Ztwo == 17 || $Ztwo == 21 || $Ztwo == 22 || $Ztwo == 27 || $Ztwo == 28 || $Ztwo == 32 || $Ztwo == 33 || $Ztwo == 38 || $Ztwo == 39 || $Ztwo == 43 || $Ztwo == 44 || $Ztwo == 49)){
                                return 1;
                            }else{
                                return 0;
                            }
                    break;
                      case 17:
                      // 合单
                        if($Ztwo = 49)return 3;
                        $arr = str_split($two, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 != 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 != 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                        }
                    break;
                      case 18:
                      // 合双
                        if($Ztwo = 49)return 3;
                        $arr = str_split($two, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 == 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 == 0 ){
                                return 1;
                            }else{
                                return 0;
                            }
                        }
                    break;
                     // 三
                      case 19:
                        if($Zthree = 49)return 3;
                        
                        if($Zthree % 2 != 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 20:
                         if($Zthree = 49)return 3;
                   
                    if($Zthree % 2 == 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 21:
                        if($Zthree = 49)return 3;
                   
                    if($Zthree >24 && $Zthree!=49 ){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 22:
                       if($Zthree = 49)return 3;
                    
                    if($Zthree <25){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 23:
                       // 红
                    $Zthree += 0;
                    
                    if(($Zthree == 1 || $Zthree == 2 || $Zthree == 7 || $Zthree == 8 || $Zthree == 12 || $Zthree == 13 || $Zthree == 18 || $Zthree == 19 || $Zthree == 23 || $Zthree == 24 || $Zthree == 29 || $Zthree == 30 || $Zthree == 34 || $Zthree == 35 || $Zthree == 40 || $Zthree == 45 || $Zthree == 46)){
                            return 1;
                        }else{
                            return 0;
                        }

                    break;
                      case 24:
                      $Zthree += 0;
                    
                    if(($Zthree == 3 || $Zthree == 4 || $Zthree == 9 || $Zthree == 10 || $Zthree == 14 || $Zthree == 15 || $Zthree == 20 || $Zthree == 25 || $Zthree == 26 || $Zthree == 31 || $Zthree == 36 || $Zthree == 37 || $Zthree == 41 || $Zthree == 42 || $Zthree == 47 || $Zthree == 48)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 25:
                        $Zthree += 0;
                    
                    if(($Zthree == 5 || $Zthree == 6 || $Zthree == 11 || $Zthree == 16 || $Zthree == 17 || $Zthree == 21 || $Zthree == 22 || $Zthree == 27 || $Zthree == 28 || $Zthree == 32 || $Zthree == 33 || $Zthree == 38 || $Zthree == 39 || $Zthree == 43 || $Zthree == 44 || $Zthree == 49)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 26:
                      // 合单
                        if($Zthree = 49)return 3;
                        $arr = str_split($three, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                      case 27:
                      // 合双
                        if($Zthree = 49)return 3;
                        $arr = str_split($three, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                    // 四
                      case 28:
                        if($Zfour = 49)return 3;
                        
                        if($Zfour % 2 != 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 29:
                         if($Zfour = 49)return 3;
                    
                    if($Zfour % 2 == 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 30:
                        if($Zfour = 49)return 3;
                    
                    if($Zfour >24 && $Zfour!=49 ){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 31:
                       if($Zfour = 49)return 3;
                    
                    if($Zfour <25){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 32:
                       // 红
                    $Zfour += 0;
                    
                    if(($Zfour == 1 || $Zfour == 2 || $Zfour == 7 || $Zfour == 8 || $Zfour == 12 || $Zfour == 13 || $Zfour == 18 || $Zfour == 19 || $Zfour == 23 || $Zfour == 24 || $Zfour == 29 || $Zfour == 30 || $Zfour == 34 || $Zfour == 35 || $Zfour == 40 || $Zfour == 45 || $Zfour == 46)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 33:
                      $Zfour += 0;
                    
                    if(($Zfour == 3 || $Zfour == 4 || $Zfour == 9 || $Zfour == 10 || $Zfour == 14 || $Zfour == 15 || $Zfour == 20 || $Zfour == 25 || $Zfour == 26 || $Zfour == 31 || $Zfour == 36 || $Zfour == 37 || $Zfour == 41 || $Zfour == 42 || $Zfour == 47 || $Zfour == 48)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 34:
                        $Zfour += 0;
                    
                    if(($Zfour == 5 || $Zfour == 6 || $Zfour == 11 || $Zfour == 16 || $Zfour == 17 || $Zfour == 21 || $Zfour == 22 || $Zfour == 27 || $Zfour == 28 || $Zfour == 32 || $Zfour == 33 || $Zfour == 38 || $Zfour == 39 || $Zfour == 43 || $Zfour == 44 || $Zfour == 49)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 35:
                      // 合单
                        if($Zfour = 49)return 3;
                        $arr = str_split($four, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                      case 36:
                      // 合双
                        if($Zfour = 49)return 3;
                        $arr = str_split($four, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                    // 五
                      case 37:
                        if($Zfive = 49)return 3;
                        
                        if($Zfive % 2 != 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 38:
                         if($Zfive = 49)return 3;
                    
                    if($Zfive % 2 == 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 39:
                        if($Zfive = 49)return 3;
                    
                    if($Zfive >24 && $Zfive!=49 ){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 40:
                       if($Zfive = 49)return 3;
                   
                    if( $Zfive <25){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 41:
                       // 红
                    $Zfive += 0;
                    
                    if(($Zfive == 1 || $Zfive == 2 || $Zfive == 7 || $Zfive == 8 || $Zfive == 12 || $Zfive == 13 || $Zfive == 18 || $Zfive == 19 || $Zfive == 23 || $Zfive == 24 || $Zfive == 29 || $Zfive == 30 || $Zfive == 34 || $Zfive == 35 || $Zfive == 40 || $Zfive == 45 || $Zfive == 46)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 42:
                      $Zfive += 0;
                    
                    if(($Zfive == 3 || $Zfive == 4 || $Zfive == 9 || $Zfive == 10 || $Zfive == 14 || $Zfive == 15 || $Zfive == 20 || $Zfive == 25 || $Zfive == 26 || $Zfive == 31 || $Zfive == 36 || $Zfive == 37 || $Zfive == 41 || $Zfive == 42 || $Zfive == 47 || $Zfive == 48)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 43:
                        $Zfive += 0;
                    
                    if(($Zfive == 5 || $Zfive == 6 || $Zfive == 11 || $Zfive == 16 || $Zfive == 17 || $Zfive == 21 || $Zfive == 22 || $Zfive == 27 || $Zfive == 28 || $Zfive == 32 || $Zfive == 33 || $Zfive == 38 || $Zfive == 39 || $Zfive == 43 || $Zfive == 44 || $Zfive == 49)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 44:
                      // 合单
                        if($Zfive = 49)return 3;
                        $arr = str_split($five, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                      case 45:
                      // 合双
                        if($Zfive = 49)return 3;
                        $arr = str_split($five, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                    // 六
                      case 46:
                        if($Zsix = 49)return 3;
                        
                        if($Zsix % 2 != 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 47:
                         if($Zsix = 49)return 3;
                    
                    if($Zsix % 2 == 0){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 48:
                        if($Zsix = 49)return 3;
                    
                    if($Zsix >24 && $Zsix!=49 ){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 49:
                       if($Zsix = 49)return 3;
                    
                    if($Zsix <25){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 50:
                       // 红
                    $Zsix += 0;
                    
                    if(($Zsix == 1 || $Zsix == 2 || $Zsix == 7 || $Zsix == 8 || $Zsix == 12 || $Zsix == 13 || $Zsix == 18 || $Zsix == 19 || $Zsix == 23 || $Zsix == 24 || $Zsix == 29 || $Zsix == 30 || $Zsix == 34 || $Zsix == 35 || $Zsix == 40 || $Zsix == 45 || $Zsix == 46)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 51:
                      $Zsix += 0;
                    
                    if(($Zsix == 3 || $Zsix == 4 || $Zsix == 9 || $Zsix == 10 || $Zsix == 14 || $Zsix == 15 || $Zsix == 20 || $Zsix == 25 || $Zsix == 26 || $Zsix == 31 || $Zsix == 36 || $Zsix == 37 || $Zsix == 41 || $Zsix == 42 || $Zsix == 47 || $Zsix == 48)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 52:
                        $Zsix += 0;
                    
                    if(($Zsix == 5 || $Zsix == 6 || $Zsix == 11 || $Zsix == 16 || $Zsix == 17 || $Zsix == 21 || $Zsix == 22 || $Zsix == 27 || $Zsix == 28 || $Zsix == 32 || $Zsix == 33 || $Zsix == 38 || $Zsix == 39 || $Zsix == 43 || $Zsix == 44 || $Zsix == 49)){
                            return 1;
                        }else{
                            return 0;
                        }
                    break;
                      case 53:
                      // 合单
                        if($Zsix = 49)return 3;
                        $arr = str_split($Zsix, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 != 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;
                      case 54:
                      // 合双
                        if($Zsix = 49)return 3;
                        $arr = str_split($Zsix, 1);
                        if (count($arr) > 1) {
                            $arr0 = intval($arr[0]);

                            $arr1 = intval($arr[1]);

                            
                            if(($arr1 + $arr0) % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                           
                        } else {
                            $arr1 = intval($arr[0]);
                            
                            if($arr1 % 2 == 0 ){
                            return 1;
                        }else{
                            return 0;
                        }
                        }
                    break;

                    default:
                        return 0;
                    break;
                }
                    
        }
        if($bet==5){
            // 正码过关
            return $this->zmgg($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$bets);
        }
        if($bet==6){
            // 特码生肖色波头尾数
            switch ($bets) {
                case 1:
                $num = $this->tm($Zseven,"鼠","鼠"); 
                return $num;   
                break;
                case 2:
                $num = $this->tm($Zseven,"牛","牛"); 
                return $num;   
                break;
                case 3:
                $num = $this->tm($Zseven,"虎","虎"); 
                return $num;   
                break;
                case 4:
                $num = $this->tm($Zseven,"兔","兔"); 
                return $num;   
                break;
                case 5:
                $num = $this->tm($Zseven,"龙","龙"); 
                return $num;   
                break;
                case 6:
                $num = $this->tm($Zseven,"蛇","蛇"); 
                return $num;   
                break;
                case 7:
                $num = $this->tm($Zseven,"马","马"); 
                return $num;   
                break;
                case 8:
                $num = $this->tm($Zseven,"羊","羊"); 
                return $num;   
                break;
                case 9:
                $num = $this->tm($Zseven,"猴","猴"); 
                return $num;   
                break;
                case 10:
                $num = $this->tm($Zseven,"鸡","鸡"); 
                return $num;   
                break;
                case 11:
                $num = $this->tm($Zseven,"狗","狗"); 
                return $num;   
                break;
                case 12:
                $num = $this->tm($Zseven,"猪","猪"); 
                return $num;   
                break;
                case 13:
                $num = $this->tm($Zseven,"ts","0"); 
                return $num;   
                break;
                case 14:
                $num = $this->tm($Zseven,"ts","1"); 
                return $num;   
                break;
                case 15:
                $num = $this->tm($Zseven,"ts","2"); 
                return $num;   
                break;
                case 16:
                $num = $this->tm($Zseven,"ts","3"); 
                return $num;   
                break;
                case 17:
                $num = $this->tm($Zseven,"ts","4"); 
                return $num;   
                break;
                case 18:
                $num = $this->tm($Zseven,"ws","0"); 
                return $num;   
                break;
                case 19:
                $num = $this->tm($Zseven,"ws","1"); 
                return $num;   
                break;
                case 20:
                $num = $this->tm($Zseven,"ws","2"); 
                return $num;   
                break;
                case 21:
                $num = $this->tm($Zseven,"ws","3"); 
                return $num;   
                break;
                case 22:
                $num = $this->tm($Zseven,"ws","4"); 
                return $num;   
                break;
                case 23:
                $num = $this->tm($Zseven,"ws","5"); 
                return $num;   
                break;
                case 24:
                $num = $this->tm($Zseven,"ws","6"); 
                return $num;   
                break;
                case 25:
                $num = $this->tm($Zseven,"ws","7"); 
                return $num;   
                break;
                case 26:
                $num = $this->tm($Zseven,"ws","8"); 
                return $num;   
                break;
                case 27:
                $num = $this->tm($Zseven,"ws","9"); 
                return $num;   
                break;
                case 28:
                $num = $this->tm($Zseven,"sb","红"); 
                return $num;   
                break;
                case 29:
                $num = $this->tm($Zseven,"sb","蓝"); 
                return $num;   
                break;
                case 30:
                $num = $this->tm($Zseven,"sb","绿"); 
                return $num;   
                break;
                default:
                    return 0; 
                break;
            }
        }
        if($bet==7){
            // 连码
            return $this->lm($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$bets,$cloums);
        }
        if($bet==8){
            // 半波
            switch ($bets) {
                case 1:
                // 红
                $Zseven += 0;
                    if(($Zseven == 1 || $Zseven == 2 || $Zseven == 7 || $Zseven == 8 || $Zseven == 12 || $Zseven == 13 || $Zseven == 18 || $Zseven == 19 || $Zseven == 23 || $Zseven == 24 || $Zseven == 29 || $Zseven == 30 || $Zseven == 34 || $Zseven == 35 || $Zseven == 40 || $Zseven == 45 || $Zseven == 46) && $Zseven%2!=0){
                        return 1;
                    }else{
                        return 0;
                    }
                
                    break;
                case 2:
                $Zseven += 0;
                    if(($Zseven == 1 || $Zseven == 2 || $Zseven == 7 || $Zseven == 8 || $Zseven == 12 || $Zseven == 13 || $Zseven == 18 || $Zseven == 19 || $Zseven == 23 || $Zseven == 24 || $Zseven == 29 || $Zseven == 30 || $Zseven == 34 || $Zseven == 35 || $Zseven == 40 || $Zseven == 45 || $Zseven == 46) && $Zseven%2==0){
                        return 1;
                    }else{
                        return 0;
                    }
                        break;
                case 3:
                $Zseven += 0;
                    if(($Zseven == 1 || $Zseven == 2 || $Zseven == 7 || $Zseven == 8 || $Zseven == 12 || $Zseven == 13 || $Zseven == 18 || $Zseven == 19 || $Zseven == 23 || $Zseven == 24 || $Zseven == 29 || $Zseven == 30 || $Zseven == 34 || $Zseven == 35 || $Zseven == 40 || $Zseven == 45 || $Zseven == 46) && $Zseven>24){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                case 4:
                $Zseven += 0;
                    if(($Zseven == 1 || $Zseven == 2 || $Zseven == 7 || $Zseven == 8 || $Zseven == 12 || $Zseven == 13 || $Zseven == 18 || $Zseven == 19 || $Zseven == 23 || $Zseven == 24 || $Zseven == 29 || $Zseven == 30 || $Zseven == 34 || $Zseven == 35 || $Zseven == 40 || $Zseven == 45 || $Zseven == 46) && $Zseven<25){
                        return 1;
                    }else{
                        return 0;
                    }
                        break;
                case 5:
                // 蓝
                $Zseven += 0;
                if(($Zseven == 3 || $Zseven == 4 || $Zseven == 9 || $Zseven == 10 || $Zseven == 14 || $Zseven == 15 || $Zseven == 20 || $Zseven == 25 || $Zseven == 26 || $Zseven == 31 || $Zseven == 36 || $Zseven == 37 || $Zseven == 41 || $Zseven == 42 || $Zseven == 47 || $Zseven == 48)&& $Zseven%2!=0){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                    case 6:
                $Zseven += 0;
                        if(($Zseven == 3 || $Zseven == 4 || $Zseven == 9 || $Zseven == 10 || $Zseven == 14 || $Zseven == 15 || $Zseven == 20 || $Zseven == 25 || $Zseven == 26 || $Zseven == 31 || $Zseven == 36 || $Zseven == 37 || $Zseven == 41 || $Zseven == 42 || $Zseven == 47 || $Zseven == 48)&& $Zseven%2==0){
                        return 1;
                    }else{
                        return 0;
                    }
                        break;
                    case 7:
                $Zseven += 0;
                    if(($Zseven == 3 || $Zseven == 4 || $Zseven == 9 || $Zseven == 10 || $Zseven == 14 || $Zseven == 15 || $Zseven == 20 || $Zseven == 25 || $Zseven == 26 || $Zseven == 31 || $Zseven == 36 || $Zseven == 37 || $Zseven == 41 || $Zseven == 42 || $Zseven == 47 || $Zseven == 48)&& $Zseven>24){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                    case 8:
                $Zseven += 0;
                    if(($Zseven == 3 || $Zseven == 4 || $Zseven == 9 || $Zseven == 10 || $Zseven == 14 || $Zseven == 15 || $Zseven == 20 || $Zseven == 25 || $Zseven == 26 || $Zseven == 31 || $Zseven == 36 || $Zseven == 37 || $Zseven == 41 || $Zseven == 42 || $Zseven == 47 || $Zseven == 48)&& $Zseven<25){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                    case 9:
                     $Zseven += 0;
                        if(($Zseven == 5 || $Zseven == 6 || $Zseven == 11 || $Zseven == 16 || $Zseven == 17 || $Zseven == 21 || $Zseven == 22 || $Zseven == 27 || $Zseven == 28 || $Zseven == 32 || $Zseven == 33 || $Zseven == 38 || $Zseven == 39 || $Zseven == 43 || $Zseven == 44 || $Zseven == 49)&& $Zseven%2!=0){
                        return 1;
                    }else{
                        return 0;
                    }
                        break;
                    case 10:
                       $Zseven += 0;
                    if(($Zseven == 5 || $Zseven == 6 || $Zseven == 11 || $Zseven == 16 || $Zseven == 17 || $Zseven == 21 || $Zseven == 22 || $Zseven == 27 || $Zseven == 28 || $Zseven == 32 || $Zseven == 33 || $Zseven == 38 || $Zseven == 39 || $Zseven == 43 || $Zseven == 44 || $Zseven == 49)&& $Zseven%2==0){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                    case 11:
                        $Zseven += 0;
                    if(($Zseven == 5 || $Zseven == 6 || $Zseven == 11 || $Zseven == 16 || $Zseven == 17 || $Zseven == 21 || $Zseven == 22 || $Zseven == 27 || $Zseven == 28 || $Zseven == 32 || $Zseven == 33 || $Zseven == 38 || $Zseven == 39 || $Zseven == 43 || $Zseven == 44 || $Zseven == 49)&& $Zseven>24){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;
                    case 12:
                        $Zseven += 0;
                    if(($Zseven == 5 || $Zseven == 6 || $Zseven == 11 || $Zseven == 16 || $Zseven == 17 || $Zseven == 21 || $Zseven == 22 || $Zseven == 27 || $Zseven == 28 || $Zseven == 32 || $Zseven == 33 || $Zseven == 38 || $Zseven == 39 || $Zseven == 43 || $Zseven == 44 || $Zseven == 49)&& $Zseven<25){
                        return 1;
                    }else{
                        return 0;
                    }
                    break;

                default:
                    return 0;
                    break;
            }
        }
        if($bet==9){
            // 正肖总肖七码
            switch ($bets) {
                case 1:
                $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"鼠");
                return $num;
                break;
                case 2:
              $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"牛");
                return $num;
                break;
                case 3:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"虎");
                return $num;
                break;
                case 4:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"兔");
                return $num;
                break;
                case 5:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"龙");
                return $num;
                break;
                case 6:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"蛇");
                return $num;
                break;
                case 7:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"马");
                return $num;
                break;
                case 8:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"羊");
                return $num;
                break;
                case 9:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"猴");
                return $num;
                break;
                case 10:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"鸡");
                return $num;
                break;
                case 11:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"狗");
                return $num;
                break;
                case 12:
               $num = $this->zx($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"猪");
                return $num;
                break;
                case 13:
                    $num = $this->zxnum($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix);
                    if($num==2||$num==3||$num==4){
                        return 1;
                    }else{
                        return 0;
                    }
                break;
                case 14:
                    $num = $this->zxnum($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix);
                    if($num==5){
                        return 1;
                    }else{
                        return 0;
                    }
                break;
                case 15:
                    $num = $this->zxnum($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix);
                    if($num==6){
                        return 1;
                    }else{
                        return 0;
                    }
                break;
                case 16:
                    $num = $this->zxnum($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix);
                    if($num==7){
                        return 1;
                    }else{
                        return 0;
                    }
                break;
                case 17:
                if(($Zone+$Ztwo+$Zthree+$Zfour+$Zfive+$Zsix)%2!=0){
                    return 1;
                }else{
                    return 0;
                }
                    break;
                case 18:
                if(($Zone+$Ztwo+$Zthree+$Zfour+$Zfive+$Zsix)%2==0){
                    return 1;
                }else{
                    return 0;
                }
                break;
                case 19:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",0);
                break;
                case 20:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",0);       
                break;
                case 21:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",0);
                break;
                case 22:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",0);
                break;
                case 23:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",1);
                break;
                case 24:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",1);
                break;
                case 25:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",1);
                break;
                case 26:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",1);
                break;
                case 27:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",2);
                break;
                case 28:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",2);
                break;
                case 29:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",2);
                break;
                case 32:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",2);
                break;
                case 31:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",3);
                break;
                case 32:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",3);
                break;
                case 33:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",3);
                break;
                case 34:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",3);
                break;
                case 35:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",4);
                break;
                case 36:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",4);
                break;
                case 37:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",4);
                break;
                case 38:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",4);
                break;
                case 39:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",5);
                break;
                case 40:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",5);
                break;
                case 41:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",5);
                break;
                case 42:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",5);
                break;
                case 43:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",6);
                break;
                case 44:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",6);
                break;
                case 45:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",6);
                break;
                case 46:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",6);
                break;
                case 47:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"单",7);
                break;
                case 48:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"双",7);
                break;
                case 49:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"大",7);
                break;
                case 50:
                    return $this->qima($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,"小",7);
                break;

                default:
                return 0 ;
                break;
            }
        }
        if($bet==10){
            // 连肖
            return $this->lxp($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$bets,$cloums);
        }
        if($bet==11){
            // 尾数连
            switch ($bets) {
                case 1:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,0);
                break;
                case 2:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,1);
                break;
                case 3:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,2);
                break;
                case 4:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,3);
                break;
                case 5:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,4);
                break;
                case 6:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,5);
                break;
                case 7:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,6);
                break;
                case 8:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,7);
                break;
                case 9:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,8);
                break;
                case 10:
                    return $this->wsl($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,9);
                break;
                default:
                    return 0;
                break;
            }
        }
        if($bet==12){
            // 多肖
            return $this->dxp($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$bets,$colums);
              
        }
        if($bet==13){
            //一肖尾数七色波
            if($colums ==1){
                        
                switch ($bets) {
                    case 1:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"鼠",1);
                        return $res;
                    break;
                    case 2:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"牛",1);
                        return $res;
                    break;
                    case 3:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"虎",1);
                        return $res;
                    break;
                    case 4:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"兔",1);
                        return $res;
                    break;
                    case 5:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"龙",1);
                        return $res;
                    break;
                    case 6:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"蛇",1);
                        return $res;
                    break;
                    case 7:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"马",1);
                        return $res;
                    break;
                    case 8:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"羊",1);
                        return $res;
                    break;
                    case 9:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"猴",1);
                        return $res;
                    break;
                    case 10:
                       $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"鸡",1);
                       return $res;
                    break;
                    case 11:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"狗",1);
                        return $res;
                    break;
                    case 12:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"猪",1);
                        return $res;
                    break;
                        case 13:
                        // 0尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,"0","中");
                        return $result;
                        break;
                         case 14:
                        // 1尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,1,"中");
                        return $result;
                        break;
                         case 15:
                        // 2尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,2,"中");
                        return $result;
                        break;
                         case 16:
                        // 3尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,3,"中");
                        return $result;
                        break;
                         case 17:
                        // 4尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,4,"中");
                        return $result;
                        break;
                         case 18:
                        // 5尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,5,"中");
                        return $result;
                        break;
                         case 19:
                        // 6尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,6,"中");
                        return $result;
                        break;
                         case 20:
                        // 7尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,7,"中");
                        return $result;
                        break;
                         case 21:
                        //8尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,8,"中");
                        return $result;
                        break;
                         case 22:
                        // 9尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,9,"中");
                        return $result;
                        break;
                        case 23:
                        // 红
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"红");
                        return $num;
                        break;
                        case 24:
                        //蓝
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"蓝");
                        return $num;
                        break;
                        case 25:
                        //绿
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"绿");
                        return $num;
                        break;
                        case 26:
                        // 和局
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"和局");
                        return $num;
                        break;
                        default:
                        return 0;
                        break;
                }
            }
            if($colums ==2){
                 switch ($bets) {
                    case 1:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"鼠",2);
                        return $res;
                    break;
                    case 2:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"牛",2);
                        return $res;
                    break;
                    case 3:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"虎",2);
                        return $res;
                    break;
                    case 4:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"兔",2);
                        return $res;
                    break;
                    case 5:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"龙",2);
                        return $res;
                    break;
                    case 6:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"蛇",2);
                        return $res;
                    break;
                    case 7:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"马",2);
                        return $res;
                    break;
                    case 8:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"羊",2);
                        return $res;
                    break;
                    case 9:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"猴",2);
                        return $res;
                    break;
                    case 10:
                       $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"鸡",2);
                       return $res;
                    break;
                    case 11:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"狗",2);
                        return $res;
                    break;
                    case 12:
                        $res = $this->yixiaoweishuqisebo($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"猪",2);
                        return $res;
                    break;
                        case 13:
                        // 0尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,"0","不中");
                        return $result;
                        break;
                         case 14:
                        // 1尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,1,"不中");
                        return $result;
                        break;
                         case 15:
                        // 2尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,2,"不中");
                        return $result;
                        break;
                         case 16:
                        // 3尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,3,"不中");
                        return $result;
                        break;
                         case 17:
                        // 4尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,4,"不中");
                        return $result;
                        break;
                         case 18:
                        // 5尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,5,"不中");
                        return $result;
                        break;
                         case 19:
                        // 6尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,6,"不中");
                        return $result;
                        break;
                         case 20:
                        // 7尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,7,"不中");
                        return $result;
                        break;
                         case 21:
                        //8尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,8,"不中");
                        return $result;
                        break;
                         case 22:
                        // 9尾
                        $result = $this->weishuzhong($arr1,$arr2,$arr3,$arr4,$arr5,$arr6,$arr7,9,"不中");
                        return $result;
                        break;
                        case 23:
                        // 红
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"红");
                        return $num;
                        break;
                        case 24:
                        //蓝
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"蓝");
                        return $num;
                        break;
                        case 25:
                        //绿
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"绿");
                        return $num;
                        break;
                        case 26:
                        // 和局
                        $num = $this->qsb($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,"和局");
                        return $num;
                        break;
                        default:
                        return 0;
                        break;
                }
            }
        }
        if($bet==14){
            // 全不中
             $bs = explode(",",$bets);
             for($i=0;$i<count($bs);$i++){
                for ($j=0; $j <7 ; $j++) { 
                    if($bs[$i]!=$res[$j]){
                        return 1;
                    }else{
                        return 0;
                    }
                }
             }
        }
        if($bet==15){
            // 多中一
            return $this->duozhongyi($Zone,$Ztwo,$Zthree,$Zfour,$Zfive,$Zsix,$Zseven,$bets,$cloums);
        }
    }

     //修改结算状态写好了
    public function jiesuan($datatime){
            $res = model('ordered')->finddatatime($datatime);//找当期符合条件注单
            $px = 0;
            foreach($res as $key => $item){
                $id = $item['id'];//自注单id
                $oid = $item['order_id'];//上级注单id                
                $user_id = $item['uid'];//下注用户id
                $bet = $item['bet'];
                $andicap = $item['andicap'];
                $colums = $item['colums'];
                $bets = $item['bets'];
                $rate = floatval($item['rate']);//注单赔率
                $price = floatval($item['price']);//注单金额
                $datatime = $datatime;
                $jiesuan = 1;
                $result[$key] = $this->resultjiesuan($bet,$colums,$bets,$datatime);//判断注单是否中奖
                $das = getpancha($andicap,$bet,$colums,$bets);
                $das = json_decode($das,true);
                if($das['n']!=0){
                    $px = model('pancha')->findandicap($das['id'],$das['n']);
                }
                $rt = model('rate')->where(['bet'=>$bet,'colums'=>$colums,'bets'=>$bets])->find();
                $name = $rt['name'];

                unset($data);
                $data = [];
                $data['content'] = inserpankous($bet,$colums,$bets,$name);
                $data['rate'] = $rt['ra']+$px;
                $data['allorder'] = $price;
                $data['uid'] = $user_id;
                $data['orders_id'] = $id;

                $data['u7tuishui'] = 0;
                $data['u7tuishui'] = 0;
                $data['u6tuishui'] = 0;
                $data['u5tuishui'] = 0;
                $data['u4tuishui'] = 0;
                $data['u3tuishui'] = 0;
                $data['u2tuishui'] = 0;
                $data['u1tuishui'] = 0;

                //下注
                $occupy = model("occupy")->where(['user_id'=>$user_id])->find();
                $data['u1price'] = $price*$occupy['houtai']/100;
                $data['u2price'] = $price*$occupy['zongjian']/100;
                $data['u3price'] = $price*$occupy['dagudong']/100;
                $data['u4price'] = $price*$occupy['gudong']/100;
                $data['u5price'] = $price*$occupy['zongdai']/100;
                $data['u6price'] = $price*$occupy['daili']/100;

                $data['u1occupy'] = $occupy['houtai'];
                $data['u2occupy'] = $occupy['zongjian'];
                $data['u3occupy'] = $occupy['dagudong'];
                $data['u4occupy'] = $occupy['gudong'];
                $data['u5occupy'] = $occupy['zongdai'];
                $data['u6occupy'] = $occupy['daili'];;

                //退水
                $rw = model("occupy")->tsinser($andicap,$bet,$c,$bets,$user_id);
                $mn = $data['allorder'] * $rw/100;
                model("Occupy")->ts($user_id,$mn,$data);



                switch($result[$key]){
                   case 1:
                        $jiangjin = $price*$rate;
                        model("Occupy")->win($user_id,$jiangjin,$data);
                        
                   break;

                   case 2:
                        $rates = model("rate")->where(['bet'=>$item['bet'],'colums'=>$colums,'bets'=>$bets])->find();
                        $das = getpancha($andicap,$item['bet'],$colums,$bets);
                            $dat = json_decode($das,true);
                            if($das['n']!=0){
                                $px = model('pancha')->findandicap($das['id'],$das['n']);
                            }
                        $jiangjin = ($rates['ra']+$px) * $price;
                        // mp1($moneys);
                        model("Occupy")->win($user_id,$jiangjin,$data);
                   break;

                   case 3:
                        model("Occupy")->dogfall($user_id,$price,$data);
                   break;
                }
                model('orders')->where('id',$id)->update(['zhongjiang' => $result[$key]]);//修改中奖状态写好了
                model('ordered')->where('id',$oid)->update(['jiesuan' => $jiesuan]);//修改结算状态写好了

                //报表
                db("profzb")->insert($data);
            }
            //补货
            $bh = db('buhuo')->where('datatime',$datatime)->select();
            //遍历，如果不中，交钱给上一级
            //如果中，从上级拿钱
            //记录补货结果
            foreach ($bh as $item) {
                $bhResult = $this->resultjiesuan($item['bet'],$item['colums'],$item['bets'],$item['datatime']);
                switch($bhResult){
                   case 1:
                   case 2:
                        $rt = model('rate')->where(['bet'=>$item['bet'],'colums'=>$item['colums'],'bets'=>$item['bets']])->find();
                        $buWinPrice = $rt['ra'] * $item['price'];

                        model('user')->where(['id'=>$item['topuser']])->setInc('employ',$buWinPrice);
                        model('user')->where(['id'=>$item['user_id']])->setDec('employ',$buWinPrice);
                        model("buhuo")->where('id',$item['id'])->update(['result'=>$buWinPrice]);
                   break;
                       
                   break;

                   case 3:
                        model('user')->where(['id'=>$item['topuser']])->setInc('employ',$item['price']);
                        model('user')->where(['id'=>$item['user_id']])->setDec('employ',$item['price']);
                        db("buhuo")->where('id',$item['id'])->update(['result'=>$item['price']]);
                   break;

                   default:
                        model('user')->where(['id'=>$item['topuser']])->setDec('employ',$item['price']);
                        model('user')->where(['id'=>$item['user_id']])->setInc('employ',$item['price']);
                        model("buhuo")->where('id',$item['id'])->update(['result'=>0-$price]);
                   break;
                }
            }
            
        return $this->error("结算成功");
    }
    
    //开封盘
    public function plate() {

        
        model('user')->where('id',session('adminid'))->update(['addrs'=>1]);
        $res = model('openplate')->findall();
        foreach ($res as $key => $v) {
            $res[$key]['Y'] = date('Y', $v['opentime']);
            $res[$key]['m'] = date('m', $v['opentime']);
            $res[$key]['d'] = date('d', $v['opentime']);
            $res[$key]['openH'] = date('H', $v['opentime']);
            $res[$key]['openi'] = date('i', $v['opentime']);
            $res[$key]['opens'] = date('s', $v['opentime']);

            $res[$key]['ctH'] = date('H', $v['tclosetime']);
            $res[$key]['cti'] = date('i', $v['tclosetime']);
            $res[$key]['cts'] = date('s', $v['tclosetime']);

            $res[$key]['czH'] = date('H', $v['zclosetime']);
            $res[$key]['czi'] = date('i', $v['zclosetime']);
            $res[$key]['czs'] = date('s', $v['zclosetime']);
        }
        $datatimess = model('openplate')->findtime(time());
        $z = $datatimess['zclosetime'];
        $t = $datatimess['tclosetime'];
        if(!$z || !$t){
            $z = time();
            $t = time();
        }
        $r = model('result')->findall();

        foreach ($r as $key => $vj) {
            $Zseven = $vj['Zseven'];
            $seven = $Zseven . "";
            $arr = str_split($seven, 1);
            if (count($arr) > 1) {
                $arr0 = intval($arr[0]);

                $arr1 = intval($arr[1]);

                if (($arr1 + $arr0) % 2 == 0) {
                    $r[$key]['hs1'] = "双";
                } else {
                    $r[$key]['hs1'] = "单";
                }
                if (($arr1 + $arr0) > 6) {
                    $r[$key]['hs2'] = "大";
                } else {
                    $r[$key]['hs2'] = "小";
                }
                 if($Zseven==49){
                    $r[$key]['hs1'] = "和";
                    $r[$key]['hs2'] = "和";
                }
            } else {
                $arr1 = intval($arr[0]);
                if (($arr1) % 2 == 0) {
                    $r[$key]['hs1'] = "双";
                } else {
                    $r[$key]['hs1'] = "单";
                }
                if (($arr1) > 6) {
                    $r[$key]['hs2'] = "大";
                } else {
                    $r[$key]['hs2'] = "小";
                }
                if($Zseven==49){
                    $r[$key]['hs1'] = "和";
                    $r[$key]['hs2'] = "和";
                }
            }

            if ($Zseven % 2 == 0) {
                $r[$key]['tm1'] = "双";
            } else {
                $r[$key]['tm1'] = "单";
            }

            if ($Zseven > 24 && $Zseven!=49) {
                $r[$key]['tm2'] = "大";
            } else if($Zseven ==49){
                $r[$key]['tm2'] = "和";
            } else{
                $r[$key]['tm2'] = "小";
            }
            $zf = $vj['Zone'] + $vj['Ztwo'] + $vj['Zthree'] + $vj['Zfour'] + $vj['Zfive'] + $vj['Zsix'] + $vj['Zseven'];
            $r[$key]['zf'] = $zf;
            if ($zf > 174) {
                $r[$key]['zf2'] = "大";
            } else {
                $r[$key]['zf2'] = "小";
            }
            if ($zf % 2 == 0) {
                $r[$key]['zf1'] = "双";
            } else {
                $r[$key]['zf1'] = "单";
            }
            $z1 = getSSNameByNum($vj['Zone']);
            $z2 = getSSNameByNum($vj['Ztwo']);
            $z3 = getSSNameByNum($vj['Zthree']);
            $z4 = getSSNameByNum($vj['Zfour']);
            $z5 = getSSNameByNum($vj['Zfive']);
            $z6 = getSSNameByNum($vj['Zsix']);
            $z7 = getSSNameByNum($Zseven);
            $ztm = array($z1, $z2, $z3, $z4, $z5, $z6, $z7);
            $ztm = $this->formatArray($ztm);
            $zx = count($ztm);
            $r[$key]['zx1'] = $zx;
            if ($zx % 2 == 0) {
                $r[$key]['zx2'] = "双";
            } else {
                $r[$key]['zx2'] = "单";
            }
            $r[$key]['sx'] = $z7;
            if ($Zseven == 1 || $Zseven == 2 || $Zseven == 7 || $Zseven == 8 || $Zseven == 12 || $Zseven == 13 || $Zseven == 18 || $Zseven == 19 || $Zseven == 23 || $Zseven == 24 || $Zseven == 29 || $Zseven == 30 || $Zseven == 34 || $Zseven == 35 || $Zseven == 40 || $Zseven == 45 || $Zseven == 46) {
                $r[$key]['sb'] = "红色";
            } else if ($Zseven == 5 || $Zseven == 6 || $Zseven == 11 || $Zseven == 16 || $Zseven == 17 || $Zseven == 21 || $Zseven == 22 || $Zseven == 27 || $Zseven == 28 || $Zseven == 32 || $Zseven == 33 || $Zseven == 38 || $Zseven == 39 || $Zseven == 43 || $Zseven == 44 || $Zseven == 49) {
                $r[$key]['sb'] = "绿色";
            } else {
                $r[$key]['sb'] = "蓝色";
            }

        }
        // mp($r);
        $announce = model('announce')->findstatus(2);
        $this->assign("z", $z);
        $this->assign("t", $t);
        $this->assign('announce',$announce);
        $this->assign("kj", $r);
        $this->assign('res', $res);
        return $this->fetch();
    }
    public function formatArray($array){
        // 合拼数组重复的
        sort($array);
        $tem = "";
        $temarray = array();
        $j = 0;
        for ($i = 0; $i < count($array); $i++) {
            if ($array[$i] != $tem) {
                $temarray[$j] = $array[$i];
                $j++;
            }
            $tem = $array[$i];
        }
        return $temarray;
    }
    //查看总报表
    public function see()
    {
        return $this->fetch();
    }

    //p赔率设置-特码
    public function oddstema() {
        model('user')->where('id',session('adminid'))->update(['addrs'=>2]);
        $resultA = model("rate")->findrateA();
        $resultB = model("rate")->findrateB();
        if (!isset($resultA)) {
            $resultA = 0;
        }

        if (!isset($resultB)) {
            $resultB = 0;
        }

        $ra1 = $resultB[0]['ra'] - $resultA[0]['ra'];
        $ra2 = $resultB[48]['ra'] - $resultA[48]['ra'];
        $ra3 = $resultB[20]['ra'] - $resultA[20]['ra'];
        if ($ra1 == $ra2 && $ra2 == $ra3) {$ra = $ra2;} else if ($ra3 == $ra1 && $ra3 == $ra2) {$ra = $ra3;} else if ($ra1 == $ra3 && $ra1 == $ra2) {$ra = $ra1;} else { $ra = 0;}
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('resultA', $resultA);
        $this->assign('resultB', $resultB);
        $this->assign('ratec', $ra);
        return $this->fetch();
    }

    //赔率设置-正码
    public function oddszhengma(){
        $reszm = model("rate")->finds(2);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('reszm', $reszm);
        return $this->fetch();
    }
    //赔率设置-正码特
    public function oddszmte(){
        $reszmte = model("rate")->finds(3);
        $this->assign('reszmte', $reszmte);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        return $this->fetch();
    }
    //赔率设置-正码1-6、正码过关
    public function oddspass() {
        $res4 = model("rate")->finds(4);
        $res5 = model("rate")->finds(5);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res4', $res4);
        $this->assign('res5', $res5);
        return $this->fetch();
    }

    //赔率设置 正特多选项
    public function oddsselert() {
        // 12多肖和10连肖
        $res10 = model("rate")->finds(10);
        $res12 = model("rate")->finds12();
        $arr = getSSNameArray();
        foreach ($res12 as $k => $v) {
            foreach ($arr as $k1 => $v1) {
                if($k1==$v['name']){
                    for($i=0;$i<count($v1);$i++){
                        $res12[$k]['num'] .= $v1[$i].",";
                    }
                }
            }
        }
        $data['鼠'] = $arr['鼠'];
        $data['牛'] = $arr['牛'];
        $data['虎'] = $arr['虎'];
        $data['兔'] = $arr['兔'];
        $data['龙'] = $arr['龙'];
        $data['蛇'] = $arr['蛇'];
        $data['马'] = $arr['马'];
        $data['羊'] = $arr['羊'];
        $data['猴'] = $arr['猴'];
        $data['鸡'] = $arr['鸡'];
        $data['狗'] = $arr['狗'];
        $data['猪'] = $arr['猪'];
        for ($j = 0; $j < count($res10); $j++) {
            $res1[$j / 4][$j % 4] = $res10[$j];
        }
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res10', $res1);
        $this->assign('res12', $res12);
        $this->assign('res', $data);
        // mp($res1);
        return $this->fetch();
    }

    //赔率设置-半波生肖头尾数
    public function oddswave(){
        $res6 = model("rate")->finds(6);
        $banbo = model("rate")->finds(8);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('banbo', $banbo);
        $this->assign('res6', $res6);
        return $this->fetch();
    }

    //赔率设置- 正总一肖尾数七色波
    public function oddsseven() {
        $res9 = model("rate")->finds(9);
        $res13 = model("rate")->finds(13);
        $res14 = model("rate")->finds(14);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res9', $res9);
        $this->assign('res13', $res13);
        $this->assign('res14', $res14);
        // mp($res14);
        return $this->fetch();
    }

    //赔率设置-不中/多中/连码
    public function oddsmiss() {
        // 14不中 和15 多中 和7连码
        $res14 = model("rate")->finds(14);
        $res15 = model("rate")->finds(15);
        $res7 = model('rate')->finds(7);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign("res7", $res7);
        $this->assign('res14', $res14);
        $this->assign('res15', $res15);
        return $this->fetch();
    }

    //赔率设置-尾数连七码
    public function oddsmantissa()
    {
        // 11尾数连和9七码
        $res11 = model("rate")->finds(11);
        $res9 = model('rate')->findrate18_50();
        for ($i = 0; $i < count($res11); $i++) {
            # code...
            $res2[$i / 3][$i % 3] = $res11[$i];
        }
        for ($j = 0; $j < count($res9); $j++) {
            $res1[$j / 4][$j % 4] = $res9[$j];
        }
        // mp($res1);
         $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res11', $res2);
        $this->assign('res9', $res1);
        return $this->fetch();
    }

    //赔率设置-自动降赔率
    public function oddssurrender()
    {
        $res = model('jiangrate')->findall();
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res',$res);
        return $this->fetch();
    }

    //赔率设置-赔率盘差
    public function oddspoor() {
        $res = model('pancha')->findall();
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res', $res);
        return $this->fetch();
    }   

    //即时注单点击金额--即注单明细表
    public function injec(){
        $announce = model('announce')->findstatus(2);
        // $a = model('ordered')->takedanhao($danhao);
        // $this->assign('times',$a);
        $this->assign('announce',$announce);
        // mp($a);
        return $this->fetch();
    }

    //即时注单--补货明细
     public function injecone(){
        model('user')->where('id',session('adminid'))->update(['addrs'=>5]);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        return $this->fetch();
    }

    //注单导出
     public function injectwo(){
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('resultZMGGRate', $resultZMGGRate);
        $this->assign('resultSQZRate', $resultSQZRate);
        $this->assign('resultwbzhong', $resultwbzhong);
        $this->assign('resultsanzhongyi', $resultsanzhongyi);
        $this->assign('resultyixiao', $resultyixiao);
        $this->assign('resultzhengxiao', $resultzhengxiao);
        return $this->fetch();
    }
    function juserid($id,$type){
        // 模拟查询ID链的接口
        if($type==2){
            $u2 = [];
            $u2['dgd'] = 0;
            $u2['gd'] = 0;
            $u2['zdl'] = 0;
            $u2['dl'] = 0;
            $u2['hy'] = 0;
            $u3 = model('user')->findtopuser($id);
            $u2['dgd'] = count($u3);
            foreach ($u3 as $ky1 => $i1) {
                $u4 = model('user')->findtopuser($i1['id']);
                $u2['gd'] += count($u4);
                foreach ($u4 as $ky2 => $i2) {
                    $u5 = model('user')->findtopuser($i2['id']);
                    $u2['zdl'] += count($u5);
                    foreach ($u5 as $ky3 => $i3) {
                        $u6 = model('user')->findtopuser($i3['id']);
                        $u2['dl'] += count($u6);
                            foreach ($u6 as $ky4 => $i4) {
                            $u7 = model('user')->findtopuser($i4['id']);
                            $u2['hy'] += count($u7);
                        }
                    }
                }
            }
            return $u2;
        }
        if($type==3){
            $u2 = [];
            $u2['gd'] = 0;
            $u2['zdl'] = 0;
            $u2['dl'] = 0;
            $u2['hy'] = 0;
            $u4 = model('user')->findtopuser($id);
            $u2['gd'] += count($u4);
            foreach ($u4 as $ky2 => $i2) {
                $u5 = model('user')->findtopuser($i2['id']);
                $u2['zdl'] += count($u5);
                foreach ($u5 as $ky3 => $i3) {
                    $u6 = model('user')->findtopuser($i3['id']);
                    $u2['dl'] += count($u6);
                        foreach ($u6 as $ky4 => $i4) {
                        $u7 = model('user')->findtopuser($i4['id']);
                        $u2['hy'] += count($u7);
                    }
                }
            }
            return $u2;
        }
        if($type==4){
            $u2 = [];
            $u2['zdl'] = 0;
            $u2['dl'] = 0;
            $u2['hy'] = 0;
            $u5 = model('user')->findtopuser($id);
            $u2['zdl'] += count($u5);
            foreach ($u5 as $ky3 => $i3) {
                $u6 = model('user')->findtopuser($i3['id']);
                $u2['dl'] += count($u6);
                    foreach ($u6 as $ky4 => $i4) {
                    $u7 = model('user')->findtopuser($i4['id']);
                    $u2['hy'] += count($u7);
                }
            }
            return $u2;
        }
        if($type==5){
            $u2 = [];
            $u2['dl'] = 0;
            $u2['hy'] = 0;
            $u6 = model('user')->findtopuser($id);
            $u2['dl'] += count($u6);
                foreach ($u6 as $ky4 => $i4) {
                $u7 = model('user')->findtopuser($i4['id']);
                $u2['hy'] += count($u7);
            }
            return $u2;
        }
        if($type==6){
            $u2 = [];
            $u2['hy'] = 0;
            $u7 = model('user')->findtopuser($id);
            $u2['hy'] += count($u7);
            return $u2;
        }
    }
    // 调用查看上级接口
    function ctop($res){
        foreach ($res as $key => $va) {
            $name = model('user')->findid($va['topuser']);
            $res[$key]['topusername']  = $name['username'];
        }
        return $res;
    }
    // 后台查询各种ID链的接口
    function chckeID($type){
       if (session('usertype') == 1) {
            $res = model('user')->findtype($type);
            $q = session('adminid');
            // $res = model('user')->findtopuser1($q);
            foreach ($res as $key => $itme) {
                $res[$key]['s'] = 0; //大股东
                $res[$key]['d'] = 0; //股东
                $res[$key]['e'] = 0; //总代理
                $res[$key]['f'] = 0; //代理
                $res[$key]['g'] = 0; //会员
                $Character = $res[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res[$key]['cap'] = $Characters;
                $s = model("user")->findtopuser($itme['id']);
                    if(!$s){
                      $res[$key]['s'] = 0;  
                    }
                    $res[$key]['s'] = count($s);
                foreach ($s as $kr => $i1) {
                    $d = model("user")->findtopuser($i1['id']);
                     if(!$d){
                          $res[$key]['d'] = 0;
                        }
                    $res[$key]['d'] += count($d);
                    foreach ($d as $kt => $i2) {
                        $e = model("user")->findtopuser($i2['id']);
                         if(!$e){
                              $res[$key]['e'] = 0; 
                            }
                        $res[$key]['e'] += count($e);
                        foreach ($e as $ky => $i3) {
                            $f = model("user")->findtopuser($i3['id']);
                             if(!$f){
                              $res[$key]['f'] = 0;
                            }
                            $res[$key]['f'] += count($f);
                            foreach ($f as $ku => $i4) {
                                $g = model("user")->findtopuser($i4['id']);
                                 if(!$g){
                                  $res[$key]['g'] = 0;
                                }
                                $res[$key]['g'] += count($g);
                            }
                        }
                    }
                }
                
            }
           return $res;
        } 
    }
    //总监
    public function director()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>5]);
        if (session('usertype') == 1) {
           $res = $this->chckeID(2);
            $this->assign('user', $res);
        }
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        return $this->fetch();
    }

    //大股东
    public function bigshareholders()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>6]);
        if (session('usertype') == 1) {
           $res = $this->chckeID(3);
            $utype = model('user')->findtype(2);
        }
        if (session('usertype') == 2) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = model('user')->finduserid(session('adminid'));
        }
        $announce = model('announce')->findstatus(2);
        $res = $this->ctop($res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('topuser',$utype);
        $this->assign('announce',$announce);
        return $this->fetch();
    }

    public function charactersubstr($Character)
    {
        $Characters['c1'] = substr($Character, 0, 1);
        $Characters['c2'] = substr($Character, 1, 1);
        $Characters['c3'] = substr($Character, 2, 1);
        $Characters['c4'] = substr($Character, 3, 1);
        return $Characters;
    }

    //股东
    public function shareholders()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>7]);
        if (session('usertype') == 1) {
           $res = $this->chckeID(4);
            $this->assign('user', $res);
            $utype = model('user')->findtype(3);
        }
        if (session('usertype') == 2) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = model('user')->findtopuser(session('adminid'));
        }
        if (session('usertype') == 3) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
                $utype = model('user')->finduserid(session('adminid'));
            }
            
        }
        $announce = model('announce')->findstatus(2);
        $res = $this->ctop($res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('topuser',$utype);
        $this->assign('announce',$announce);
        return $this->fetch();
    }

    //总代理
    public function bigangent()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>8]);
        if (session('usertype') == 1) {
           $res = $this->chckeID(5);
            $this->assign('user', $res);
            $utype = model('user')->findtype(4);
        }
        if (session('usertype') == 2) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = [];
            $utype1 = model('user')->findtopuser(session('adminid'));
            foreach ($utype1 as $key => $v) {
                $utypes = model('user')->findtopuser($v['id']);
                $utype[]= $utypes; 
            }    
        }
        if (session('usertype') == 3) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = model('user')->findtopuser(session('adminid'));
            
        }
        if (session('usertype') == 4) {
             $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = model('user')->finduserid(session('adminid'));
        }
        $announce = model('announce')->findstatus(2);
        $res = $this->ctop($res);
        $this->assign('topuser',$utype);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('announce',$announce);
        // mp1($res);
        return $this->fetch();
    }

    //代理
    public function angent()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>9]);
        if (session('usertype') == 1) {
           $res = $this->chckeID(6);
            $this->assign('user', $res);
        $utype = model('user')->findtype(5);
        }
        if (session('usertype') == 2) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = [];
            $utype1 = model('user')->findtopuser(session('adminid'));
            foreach ($utype1 as $key => $v) {
                $utypes = model('user')->findtopuser($v['id']);
                foreach ($utypes as $k1 => $v1) {
                   $utype2 = model('user')->findtopuser($v1['id']);
                   $utype[] = $utype2;
                }
            }
        }
        if (session('usertype') == 3) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = [];
            $utype1 = model('user')->findtopuser(session('adminid'));
            foreach ($utype1 as $key => $v) {
                $utypes = model('user')->findtopuser($v['id']);
                $utype[]= $utypes; 
            }
            
        }
        if (session('usertype') == 4) {
             $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = model('user')->findtopuser(session('adminid'));
            
        }
        if (session('usertype') == 5) {
            $q = session('adminid');
            $res = model('user')->findtopuser($q);
            foreach ($res as $ky => $item) {
                $Character = $res[$ky]['andicap'];
                $res[$ky]['cap'] = $Characters;
                $Characters = $this->charactersubstr($Character);
                $u3 = $this->juserid($item['id'],$item['types']);
                $res[$ky]["s"] = 1;
                $res[$ky]["d"] = $u3['gd'];
                $res[$ky]["e"] = $u3['zdl'];
                $res[$ky]["f"] = $u3['dl'];
                $res[$ky]["g"] = $u3['hy'];
            }
            $utype = model('user')->finduserid(session('adminid'));
            
        }
        
        $announce = model('announce')->findstatus(2);
        $res = $this->ctop($res);
        $this->assign('topuser',$utype);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('user', $res);
        $this->assign('announce',$announce);
        return $this->fetch();
    }

    //会员
    public function members()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>10]);
        if (session('usertype') == 1) {
            $res = model('user')->finduser(7);
            foreach ($res as $key => $itme) {
                $Character = $res[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res[$key]['cap'] = $Characters;
            }
            $utype = model('user')->findtype(6);
            $this->assign('user', $res);
        }
        if (session('usertype') == 2) {
            $res = model('user')->finduser(7);
            foreach ($res as $key => $itme) {
                $Character = $res[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res[$key]['cap'] = $Characters;
            }
            $utype = [];
            $utype1 = model('user')->findtopuser(session('adminid'));
            foreach ($utype1 as $key => $v) {
                $utypes = model('user')->findtopuser($v['id']);
                foreach ($utypes as $k1 => $v1) {
                   $utype3 = model('user')->findtopuser($v1['id']);
                   foreach ($utype3 as $k2 => $v2) {
                    $utype4 = model('user')->findtopuser($v2['id']);
                        $utype[] = $utype4;
                   }
                }
            }
            $this->assign('user', $res);
        }
        if (session('usertype') == 3) {
            $res = model('user')->finduser(7);
            foreach ($res as $key => $itme) {
                $Character = $res[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res[$key]['cap'] = $Characters;
            }
            $utype = [];
            $utype1 = model('user')->findtopuser(session('adminid'));
            foreach ($utype1 as $key => $v) {
                $utypes = model('user')->findtopuser($v['id']);
                foreach ($utypes as $k1 => $v1) {
                   $utype2 = model('user')->findtopuser($v1['id']);
                   $utype[] = $utype2;
                }
            }
            $this->assign('user', $res);
        }
        if (session('usertype') == 4) {
            $res = model('user')->finduser(7);
            foreach ($res as $key => $itme) {
                $Character = $res[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res[$key]['cap'] = $Characters;
            }
            $utype = [];
            $utype1 = model('user')->findtopuser(session('adminid'));
            foreach ($utype1 as $key => $v) {
                $utypes = model('user')->findtopuser($v['id']);
                $utype[]= $utypes; 
            }
            $this->assign('user', $res);
        }
        if (session('usertype') == 5) {
            $res = model('user')->finduser(7);
            foreach ($res as $key => $itme) {
                $Character = $res[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res[$key]['cap'] = $Characters;
            }
            $utype = model('user')->findtopuser(session('adminid'));
            $this->assign('user', $res);
        }
        if (session('usertype') == 6) {
            $q = session('adminid');
            $res = model('user')->findtopuser1($q);
            $res1 = [];
            for ($i = 0; $i < sizeof($res); $i++) {
                $a = $res[$i]['id'];
                $p = model('user')->finduserid($a);
                $res1[] = $p[0];
            }foreach ($res1 as $key => $itme) {
                $Character = $res1[$key]['andicap'];
                $Characters = $this->charactersubstr($Character);
                $res1[$key]['cap'] = $Characters;
            }
            $utype = model('user')->finduserid(session('adminid'));
            $this->assign('user', $res1);
        }
        $this->assign('topuser',$utype);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        // mp1($res);
        return $this->fetch();
    }

    //操盘员
    public function Traders(){
        model('user')->where('id',session('adminid'))->update(['addrs'=>11]);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        return $this->fetch();
    }

    //系统配置
    public function system()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>12]);
        $xitong1 = model('xitong')->findid(1);
        $xt2 = model('xitong')->findid(2);
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('xt2', $xt2);
        $this->assign('xt1', $xitong1);
        $this->assign('ressx', $ressx);

        $dirs = scandir(APP_PATH."../public/Data");
        $files = [];
        foreach ($dirs as $file) {
            if($file == "." || $file=="..")continue;
            $files[] = ['file'=>$file,'name'=>substr($file, 3,10)];
        }
        $this->assign("files",$files);
        return $this->fetch();
    }

    // 在线人员
    public function Onlinepersonnel()
    {
        model('user')->where('id',session('adminid'))->update(['addrs'=>14]);
        // 1后台 2总监 3大股东 4股东 5总代理 6代理 7会员
        $res['zs'] = model('user')->findscount();
        $res['ht'] = model('user')->finuser(1);
        $res["zj"] = model('user')->finuser(2);
        $res["dgd"] = model('user')->finuser(3);
        $res["gd"] = model('user')->finuser(4);
        $res['zdl'] = model('user')->finuser(5);
        $res['dl'] = model('user')->finuser(6);
        $res['hy'] = model('user')->finuser(7);
        $res['htzz'] = model('user')->findhoutaizz();
        $result = model('user')->selectuser();
        foreach ($result as $key => $value) {
            $result[$key]['huodong'] = time()-$result[$key]['intime'];
        }
        $announce = model('announce')->findstatus(2);
        $this->assign('announce',$announce);
        $this->assign('res', $res);
        $this->assign('result',$result);
        return $this->fetch();
    }
}
